• 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

Read users and passwords from a txt file

How do I refresh a DIV content?

Laravel phpunit test failing authorization

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

How to reset Laravel AuthManager/guards in between API calls in tests?

PHP Deprecated issue when running artisan command

Insert database rows from columns of data from associative array of indexed arrays

PDOException SQLSTATE[HY000] [2002] No such file or directory

PHP date() with timezone?

PHP - Store information with NO database

how to prevent float variables displaying as scientific notation when printing [duplicate]

How to test a php login connected to a mysql db through xampp?

phpseclib 2.0 can not use Composer to create autoload

How to convert the int value to inch in PHP [closed]

Access relation of pivot table in Laravel

About Contact Privacy policy Terms and conditions