• 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 a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

How to convert a carbon into string, to take the date only?

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

Testing subscription renewals on Stripe

Remove country code from phone number?

browsersync doesn't work with XAMPP

str_replace or preg_replace random number from string

MISSING UPDATES FOR: MEDIA Drupal 9

Google API Heatmap Layer exception, why?

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

Check if a string contain multiple specific words

PHP only Hit Counter?

Attempted to call an undefined method named "get" of class "MailController"

Handle error for duplicate entries - PHP/MySQL

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

About Contact Privacy policy Terms and conditions