• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to validate tin and cst using PHP?

php


PHP Snippet 1:

function validateFieldByRegex($regex , $string)
{
    if ( !preg_match($regex, $string) ) {
        echo 'incorrect string';
    } else {
        echo 'correct string';
    }
}

validateFieldByRegex('/^[1-9]([0-9]{1,10}$)/', '33392964390');
validateFieldByRegex('/^[1-9]([0-9]{1,6}$)/', '1280154');

PHP Snippet 2:

^(3[0-5]|[012][0-9]|[1-9])\d{9}$

Related Snippets

PHP: Telegram Bot: Insert line break to text message

Redirect to previous page with php

Having issue with matching rows in the database using PDO

Last order would be re-order in wooCommerce. How is it possible?

Clients authentication and user authentication with laravel

how to check version of codeigniter framework?

How to test laravel controller method?

PHP date() with timezone?

Wordpress how to get the post thumbnail inside a figure tag

Dynamic table in HTML using MySQL and php

PHP array slice from position + attempt to return fixed number of items

PHP how to detect if running on arm64 cpu?

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

Toggle between a textbox and a select using PHP

Symfony - "framework.test" config is not set to true

About Contact Privacy policy Terms and conditions