• 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

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

Message: Set sys_temp_dir in your php.ini after installed composer

Render the content of default_filter.php in Joomla front-end

With doctrine ODM, can I embed many subdocuments in a main document?

Find out the name of the last script that included the current one

Error Class "LaravelFortifyFeatures" not found

If action is on a different page do I use fwrite function

Eloquent insert id with sequence next value

MySQL upgrade causing unexpected results on simple WHERE clauses

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

How to install php_imagick on wamp64

How to fix Call to undefined method AppModelsTableName::factory?

Connecting an HTML webpage to a SQL Server

Get image type from base64 encoded src string

About Contact Privacy policy Terms and conditions