• 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

Detect a fetch request in PHP

OctoberCMS / Anonymous Global Scope

Batch request Google Calendar php API

Target Laravelista is not instantiable

Find out the name of the last script that included the current one

PHP: set a (deep) array key from an array [closed]

Laravel Schedule not sending email

How to get transaction details in notify_url page in paypal

How to check user Permissions using Custom Middleware in Laravel

Yii2: How do I debug console commands?

PHP function Not Working As Expected From functions.php Include File

javascript html popup window

Natural ORDER in Laravel Eloquent ORM

Transpose csv file data [duplicate]

WooCommerce Subscriptions: Remove role on cancelled subscription

About Contact Privacy policy Terms and conditions