• 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 delete old images from public folder on update using Laravel

Getting values for an enum?

Handling expired token in Laravel

Show rotation of tweets using current day of month

How can I get new CSRF token in LARAVEL by using ajax

Composer fails with kylekatarnls/update-helper on new homestead

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Match single unknown parameter php (Morse-code Regex)

PHPMetrics option --excluded-dirs="myfolder" : myfolder dir is not excluded within docker

Pages are working fine on localhost but not running on the hosting server

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

PHP mail function is sending blank message body

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

How to Make Laravel Eloquent "IN" Query?

PHP block shortcut in Visual Studio Code

About Contact Privacy policy Terms and conditions