• 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

How to give apache permission to write to home directory?

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

Download & Save Zoom Recording in directory by PHP

PHP: How to raise number to (tiny) fractional exponent?

Malformed MIME header error in Symfony 5.3

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

Select option from dropdown menu with PHP and mySql

User pool client {id}does not exist

PHP - installing Xdebug on Mac with XAMPP (Unix File)

calling server using nusoap with complextype

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

PHP Include for HTML?

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

protect my blog content

Set quantity minimum, maximum and step at product level in Woocommerce

About Contact Privacy policy Terms and conditions