• 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

Display specific shipping method if woocommerce product has specific acf field value

Batch request Google Calendar php API

Message: Set sys_temp_dir in your php.ini after installed composer

Fatal error: Uncaught mysqli_sql_exception: Unknown database 'test' in ... (How do I fix that? Using PHP)

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

Unable to create lockable file - Laravel 8 & PHP 8

Error Class "LaravelFortifyFeatures" not found

Laravel Delete and Update

Entity provider not working in security.yml php symfony3.4 ({"code":401,"message":"bad credentials"}.)

WordPress Security Standards want me to escape my html, but how to do it correctly?

Add rows to Single product Additional information table in WooCommerce 3.6

Laravel database insert with combining array and string

Problem with fetching data from database in Laravel

How to make a foreign key not using primary key

How can I format this number correctly using PHP?

About Contact Privacy policy Terms and conditions