• 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

if statement inside concatenation

Input and output values for php into the browser?

PHP mail sending empty mails

Toggle between a textbox and a select using PHP

Laravel post contact form giving me error 419

PHP drop down list using array's and foreach (else and for) code

Call to a member function fetch_field() on a non-object MySQLiDB

Laravel Unresolvable dependency resolving [Parameter #0 [ <required> $method ]] in class GuzzleHttpPsr7Request

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

retrieve data from database using session

Unable to uninstall brew php from homebrew

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

How update php.ini on a Mac OS X Mojave?

How to fix bootstrap multiselect search data using ajax

How to install PHP composer inside a docker container

About Contact Privacy policy Terms and conditions