• 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 install ZeroMQ for PHP on an Alpine Linux container?

Adding the custom page with add_menu_page function on Wordpress

Laravel Multi-language routes without prefix

Parameter is not sent to Laravel route in Ajax

virtctl works when executed via command line but not from php exec()

Clear javascript source cache laravel 5.8

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

Laravel Passport - Not able to get token string in response?

Composer fails with kylekatarnls/update-helper on new homestead

httpd.conf on Windows: can't locate API model structure `php8_module`

How to change the app environment at run time?

PHP: PDO + CSV export not downloading (headers issue?)

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

Shortcode or PHP inside a shortcode in Wordpress

jQuery Ajax Post with data

About Contact Privacy policy Terms and conditions