• 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

Problems getting instance of UploadedFile in Yii2

Laravel Collections. Is there some kind of assertStructure method?

WooCommerce - unset "<product> removed notice…" on cart page

Entity provider not working in security.yml php symfony3.4 ({"code":401,"message":"bad credentials"}.)

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

PHP block shortcut in Visual Studio Code

Multiple order by in WooCommerce

args[max_input] woocommerce if statement confused

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

Don't show recurring price for WooCommerce subscriptions worth 0$

How to disable only_full_group_by option in Laravel

Why rand() every time I refresh the page?

How to skip cart page on woocomerce for certain products only?

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

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

About Contact Privacy policy Terms and conditions