• 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

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

echo language construct is discouraged. (PHP)

php file upload scanning using clamav, permissions on /tmp/

how can I set a session variable in Drupal 8 and get it in a php script?

Reading input in php from terminal

Group data in a multidimensional array based on two columns

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

php retrieve specific data onclick from database in a list format

(Laravel) How to delete multiple models including optional relationships?

How can I get data from PHP to Android TextView?

Laravel - Implicit route model binding with soft deleted data

WordPress + Nginx on non-standard port behind AWS ELB results in broken links

PHP block shortcut in Visual Studio Code

How to to send mail using gmail in Laravel?

Elastic Beanstalk with Laravel Envoy

About Contact Privacy policy Terms and conditions