• 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

Facebook API, get page post link (PHP)

Make survey at laravel 5.4 and MySQL

Pass a select with mysqli_fetch_row to a table

Can I use a WooCommerce function without any WooCommerce page?

backup files to google drive using PHP

phpunit - testing is painfully slow

CSV to PHP class properties

How to create a scheduler application in php

Symfony 4: how to allow dynamic values for array nodes in bundle configuration?

Getting error: CodeIgniterDatabaseBaseResult::getResult in CodeIgniter

Pass an image through AJAX [duplicate]

Show only featured products in Woocommerce shop page

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

Target Laravelista is not instantiable

How to convert binary string to normal string in php

About Contact Privacy policy Terms and conditions