• 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

PHP - CURL using HTTPS [closed]

Laravel 5 session not persisting after user is logged in

"There is no active transaction" when refreshing database in Laravel 8.0 test

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

Laravel: HTML in notification

Return new collection without modifying original collection

browsersync doesn't work with XAMPP

Laravel 5.2: Unable to locate factory with name [default]

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 11 [closed]

WooCommerce: Add/display Product or Variation custom field everywhere

Filter array by skipping every nth element from the end

Get latest Tweets - What API

Combining a describing and one array with data

Pass an image through AJAX [duplicate]

Symfony/Form add attribute based on the data

About Contact Privacy policy Terms and conditions