• 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

PHP password_verify

How to make a array inside array?

PHP -> Next nearest date defined by array of days in week

Confirm Leave on External Links in Wordpress

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

CONCAT columns with Laravel 5 eloquent

Unable to Edit config.inc.php

html-php form submission after validation through JavaScript [closed]

Doctrine 2 mapping referencing unique key

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

How to display table header in every page using FPDF library?

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

Cannot connect to own websocket server when on secured domain

Minimum order amount except for specific shipping method in WooCommerce

About Contact Privacy policy Terms and conditions