• 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

Laravel relationship belongsToMany with composite primary keys

Multiply each value in array using array_map function

PHP array, move keys and values to new array, but mix it up

Warning: sqlite_query() expects parameter 1 to be resource, string given

Where do I need to place a hook for phpunit?

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

PHP date() with timezone?

Laravel Get Days In Month From Month Number?

I cannot create a auto generated date time in mysql workbench

Multiple order by in WooCommerce

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

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

Display specific shipping method if woocommerce product has specific acf field value

Yii2 redirecting to previous page after login

yii2 and mssql insert varbinary into model

About Contact Privacy policy Terms and conditions