• 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 - Not able to get token string in response?

Laravel relationship belongsToMany with composite primary keys

How to average columns of data from multiple, flat arrays?

How to get transaction details in notify_url page in paypal

Laravel no logout option from menu after successfull login

Sort a multidimensional array by integer inside of a string value which is two levels down

Open a popup box after receiving result from ajax

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

How to get company posts from LinkedIn via API?

Select option from dropdown menu with PHP and mySql

How to update array value in Laravel

protect my blog content

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

Issue with laravel eloquent model property

About Contact Privacy policy Terms and conditions