• 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 insert Google Adsense Code in PHP script?

Convert date and time to Jalali in Laravel

php 7 php.ini upload_max_filesize not working

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

Batch request Google Calendar php API

Get number of working days between two dates in PHP [duplicate]

Google Gmail API - How to login programatically?

Shopify password update using Shopify API

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

SQL AVG() to 2 decimals

ldap is missing from system when installing adldap2 in laravel

Upgrade PHP on AWS Linux

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

Update Order custom Field value with WooCommerce REST API

How to run or debug php on Visual Studio Code (VSCode)

About Contact Privacy policy Terms and conditions