• 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

GRPC installed successfully on ubuntu but php is looking for it in another folder

Get keys from associative array [duplicate]

Magento 2 - How to add new block to admin panel in product page?

Exact alternate to mcrypt_encrypt in PHP 7.2

Having trouble with PDO queries (Notice: Undefined index)

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

How to display MySQL table using php and edit it in a web browser

file_put_content...fail to open stream:Permission denied in Laravel 5

Yii2 select2 database exception number of bound variables does not match number of tokens

Laravel Excel::store file empty after stored

Laravel phpunit test failing authorization

Sort multidimensional array by column value within a column

Call to a member function givePermissionTo() on null

curl returning 301 error after migrating to https

Symfony Make:Migration : The metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue

About Contact Privacy policy Terms and conditions