• 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

PHPUnit 7: Failed asserting that exception of type InvalidArgumentException is thrown

Combine array with same value and add other [duplicate]

Display the WooCommerce product price inside a custom function

Applying programmatically a coupon to an Order in WooCommerce3

How to Install Composer Require doctrine/dbal

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

Send same name multiple checkbox values via ajax

WAMP Virtual Host not working

How to identify whether webp image is static or animated?

SQL to convert multiple rows into a single row of variable length

Phpunit partial mock + proxy Entity

Uploading video to Youtube using Youtube Data API V3 and Google API Client PHP -- getting 401 (unauthorized) message

hidden INPUT value not available in $_POST

Call authenticate manually in router middleware

PHPS source file - 403 Forbidden You don't have permission to access this resource

About Contact Privacy policy Terms and conditions