• 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

Dropzone: Submit both form data and dropzone at once

How to create a individual template for page or post in custom plugin?

Explode not working properly with dash

Add restriction to WooCommerce coupons by allowed user ID

PHP: Insert marker every 3 iterations

How to find the date a user created their Google account

How do I get friend list from Friends table with counts of friends of my friends

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

How to install php yaml on CentOs?

Use same method for inertia response and json response Laravel Jetstream

How to convert the int value to inch in PHP [closed]

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Boolean assignment operators in PHP

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

Convert date and time to Jalali in Laravel

About Contact Privacy policy Terms and conditions