• 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

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

PHP function Not Working As Expected From functions.php Include File

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

laravel 5.6 bulk inserting json data

How can I get new CSRF token in LARAVEL by using ajax

Laravel SQL query midnight time not showing

PHP: convert all UTF-8 characters to HTML entities

Laravel MSSQL Server Connection not working

PHP mail sending empty mails

PHP Sorting - getting 10, 11, 12 ... 1, 20, 2 rather than 1, 10, 11, 12 ... 2, 20

Get keys from associative array [duplicate]

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

How to skip cart page on woocomerce for certain products only?

Target Laravelista is not instantiable

Target Individual Form Instance/Counter Inside A PHP While Loop

About Contact Privacy policy Terms and conditions