• 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

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

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

Query Optimization, changing the queries in the loop into a single processing query

Send same name multiple checkbox values via ajax

Facebook API, get page post link (PHP)

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

How to convert a carbon into string, to take the date only?

How can I pass the list to the component variable in Laravel?

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

How to get unique slug to same post-title for other time too?

How to remove index.php and index from the URL using htaccess | PHP

laravel sanctum Route [login] not defined

html-php form submission after validation through JavaScript [closed]

PHP Deprecated issue when running artisan command

PHP header location absolute URL

About Contact Privacy policy Terms and conditions