• 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 get company posts from LinkedIn via API?

How can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

woocommerce_wp_select options array from product attribute terms

possible options to create pdf file using html elements to generate invoice in php and codeigniter

printing all running session variable in laravel 5.1

Assign output of PHP function to a variable

Hide email address with stars (*)

Unit (real unit test) of test laravel relationship

Star and Half Star Rating in Laravel

Laravel no logout option from menu after successfull login

PHP date() with timezone?

Getting error: CodeIgniterDatabaseBaseResult::getResult in CodeIgniter

phpunit - mockbuilder - set mock object internal property

How to send parameters in soap request in php in __soapcall() function

Must be of the type array, null given,

About Contact Privacy policy Terms and conditions