• 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

"cannot list resources" error from WooCommerce REST API

Get number of working days between two dates in PHP [duplicate]

PHP Find Array Index value in multi-line array

How do I Post to .txt document before form submits

How to use PHPCBF to fix one issue at a time?

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

html-php form submission after validation through JavaScript [closed]

PHP: PDO + CSV export not downloading (headers issue?)

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

How to add automatically collapse/expand in content wordpress (single.php)?

how to hide previous markers when new markers added in google map javascript api

Target Individual Form Instance/Counter Inside A PHP While Loop

PHP - Store information with NO database

XML to CSV with PHP converter [problem with images grabing]

Adding hreflang tags automatically in WordPress subdirectory multisite

About Contact Privacy policy Terms and conditions