• 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

Unable to match results of php hash_hmac() and coldfusion hmac()

Which is faster php date functions or carbon?

generating a random code in php?

GRPC installed successfully on ubuntu but php is looking for it in another folder

Group data in a multidimensional array based on two columns

How to override header set in Apache config with more specific header in a virtual host

php code to send checkbox form results to email

How to create a scheduler application in php

Hide email address with stars (*)

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

How to reset Laravel AuthManager/guards in between API calls in tests?

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

correct PHP headers for pdf file download

How to disable only_full_group_by option in Laravel

Require a class from another class - php

About Contact Privacy policy Terms and conditions