• 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

Search for array row with specific column value and return another value from qualifying row

Artisan, creating tables in database

Getting public posts of a random user from Facebook API

How to test laravel controller method?

Don't show recurring price for WooCommerce subscriptions worth 0$

With doctrine ODM, can I embed many subdocuments in a main document?

Elastic Beanstalk with Laravel Envoy

PHP array_filter with arguments

Reading input in php from terminal

how to check version of codeigniter framework?

PHP: Telegram Bot: Insert line break to text message

Show rotation of tweets using current day of month

PhP how to calculate moments with variables rows

How to get AJAX to post on second page?

Laravel eloquent update record without loading from database

About Contact Privacy policy Terms and conditions