• 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

If you intend you use SMTP, add your SMTP Code after this Line

Laravel no logout option from menu after successfull login

stay with the last 15 elements of an array [duplicate]

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

How to get AJAX to post on second page?

carbon generated datetime not stored correctly into the database

Get number of working days between two dates in PHP [duplicate]

How to check user Permissions using Custom Middleware in Laravel

Refresh specific HTML content that retrieves data from MySQL

Pages are working fine on localhost but not running on the hosting server

Reading input in php from terminal

Filter WooCommerce related products by Polylang language

Best way to scrolldown onpageload

"Unable to load dynamic library 'pdo_sqlsrv.so' "Cenos7 PHP7.2.10

printing all running session variable in laravel 5.1

About Contact Privacy policy Terms and conditions