• 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 8 - libxml_disable_entity_loader() has been deprecated. How do I replace the functionality it provides?

Add record for each array elements if missing in table

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

Laravel Pagination links() not working

Having issue with matching rows in the database using PDO

XDebug not working in VScode for php debugging

Laravel PHP: multiple project run at the same time [closed]

find in set in laravel ? example

laravel 5.6 bulk inserting json data

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

How can I make a full text index of the column?

Magento 2 - Controller returning blank page

How To Access A Column In M-M Relationship Table In Laravel

Applying programmatically a coupon to an Order in WooCommerce3

Coinpayments create_transaction "ERROR: Invalid command!"

About Contact Privacy policy Terms and conditions