• 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

Minimum order amount except for specific shipping method in WooCommerce

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

Group rows by column and sum another column within groups [duplicate]

Distribute array row data to make multiple new rows

PHP Download MP3 files from directory on server

Pass a select with mysqli_fetch_row to a table

JQuery content editable div and text box on submit not sending POST

add_action() function in wordpress not working [duplicate]

phpunit - mockbuilder - set mock object internal property

PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: no such host known

Boolean assignment operators in PHP

Override default Auth routes in Laravel 7

insert multiple rows in a saveall in cakephp

How to show a popup modal in codeIgniter?

How to edit Records using CodeIgniter

About Contact Privacy policy Terms and conditions