• 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 do I remove this delivery notification from here?

Wordpress how to get the post thumbnail inside a figure tag

onKeyUp event calculation not working on the following rows from php generated forms except the first one

How to test a php login connected to a mysql db through xampp?

Target Individual Form Instance/Counter Inside A PHP While Loop

What is my SQL missing?

Laravel no logout option from menu after successfull login

str_replace or preg_replace random number from string

What's the net::ERR_HTTP2_PROTOCOL_ERROR about?

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

CodeIgniter 3 is generating a session file on each request, why?

PHP Array split string and Integers

PHP: Convert any string to UTF-8 without knowing the original character set, or at least try

PHP function Not Working As Expected From functions.php Include File

PHP only Hit Counter?

About Contact Privacy policy Terms and conditions