• 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 load Codeigniter 4 lang file into an array variable

Yii2: How do I debug console commands?

PhP how to calculate moments with variables rows

How to skip cart page on woocomerce for certain products only?

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

PHP: Print caught exception like Xdebug

How to Display Data in Yajra Datatables Laravel 7?

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

Artisan, creating tables in database

Laravel views are showing from cache on one server but works fine on other server

Not able to override collapsible.js in magento 2

How to get an Array value inside an object in an array Php [duplicate]

how can I set a session variable in Drupal 8 and get it in a php script?

Using PHP to connect to a remote MSSQL database

Merge column values from two arrays to form an indexed array of associative arrays

About Contact Privacy policy Terms and conditions