• 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

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

Could not decode a text frame as UTF-8.

Parameter is not sent to Laravel route in Ajax

Natural ORDER in Laravel Eloquent ORM

Laravel unique validation on multiple columns

Laravel Sanctum CSRF not authenticating

Adding reCAPTCHA v2 into my PHP file

How to disable only_full_group_by option in Laravel

Laravel 5 session not persisting after user is logged in

PHP random string generator

Laravel print last executed SQL query with Query log

Can't find vendor/autoload.php for Ratchet

Laravel - How to properly generate unique slugs from article titles?

PHP - installing Xdebug on Mac with XAMPP (Unix File)

How do I loop through an MS SQL database with VB.NET?

About Contact Privacy policy Terms and conditions