• 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 to map the two arrays with a duplicate value?

The sum of the user's points

Show only featured products in Woocommerce shop page

Laravel - Browser displays message again when I press back button

PHP - Check if string contains words longer than 4 characters, then include "+ *", and for those shorter than 4 characters include only "*"

Autoloading classes in PHPUnit using Composer and autoload.php

add_action() function in wordpress not working [duplicate]

PHP Find Array Index value in multi-line array

Laravel relationship belongsToMany with composite primary keys

How to connect to MSSQL Server with PHP from Ubuntu 18.04?

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

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

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

how to make my own auto increment in php?

Need to display only array value in JSON output

About Contact Privacy policy Terms and conditions