• 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

GRPC installed successfully on ubuntu but php is looking for it in another folder

How to get Laravel's CSRF Token from Another Website?

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

How can i call a function that executes an fpdf based on the choice of a form selector?

HTML + PHP + PHPMAILER

How to assert parameter attribute sub-structures in PHPUnit mock call expectations

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given [duplicate]

PHP using str_starts_with for array to exclude same as with wildcard

Make survey at laravel 5.4 and MySQL

Performance of foreach, array_map with lambda and array_map with static function

Store multiple fields in JSON column (Nova CMS)

Select option menu read from database and use it's values

Laravel passport auth token not working after moving to different server

passwordless LDAP login and get user information using Kerberos ticket in PHP

About Contact Privacy policy Terms and conditions