• 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 5.1 xmlHttpRequest AJAX POST TokenMismatchException

How to convert binary string to normal string in php

PHP Include for HTML?

Why i get wrong output for html markdown?

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

How can I easily switch between PHP versions on Mac OSX?

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

Combine array with same value and add other [duplicate]

how to pass row id in href of a tag in codeigniter controller?

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource [duplicate]

WordPress Security Standards want me to escape my html, but how to do it correctly?

Fatal error: Array callback has to contain indices 0 and 1

Laravel 5 session not persisting after user is logged in

PHP DOTENV unable to load env vars

Laravel-fopen: failed to open stream: Permission denied

About Contact Privacy policy Terms and conditions