• 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

Appending data to an anchor tag

Laravel views are showing from cache on one server but works fine on other server

Creating a config file in PHP

file_get_contents() without "Http" to access external URL [closed]

Applying programmatically a coupon to an Order in WooCommerce3

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

Inserting data into SQL Server Db An Invalid direction was specified

MySQL order by field in Eloquent

Get keys from associative array [duplicate]

Sum array values of a column within each column of an array with 3 levels

Laravel multi auth - Authentication user provider [] is not defined

CodeIgniter 3 is generating a session file on each request, why?

Handle error for duplicate entries - PHP/MySQL

Handling expired token in Laravel

how to redirect the user back to desired URL after login page in PHP?

About Contact Privacy policy Terms and conditions