• 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

Laravel passport auth token not working after moving to different server

How to get monthly wise data in laravel

How to change 'users' auth table and use another instead Laravel

Remove categories with all childs derived from parent category

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

Composer Warning: openssl extension is missing. How to enable in WAMP

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

How to submit a form when page loads using JavaScript?

Fatal error: Uncaught mysqli_sql_exception: Unknown database 'test' in ... (How do I fix that? Using PHP)

Add New Parameter to Existing URL using htaccess

How to add a custom field to all Woocommerce attribute terms using add_action

Shortcode or PHP inside a shortcode in Wordpress

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

How to set dynamic `home` and `siteurl` in WordPress?

Get number of working days between two dates in PHP [duplicate]

About Contact Privacy policy Terms and conditions