• 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

What is my SQL missing?

PHP-Sort array based on another array?

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

Unit (real unit test) of test laravel relationship

Alert message after submitting form in PHP

loop through an anchor id

Get sql.h error on MacOS 12 (Monterey) sqsrv and pdo_sqsrv drive installation

Check for PDO Results, If None Display Message, If Yes then Loop Through

how to check version of codeigniter framework?

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

Sum array values of a column within each column of an array with 3 levels

Select option from dropdown menu with PHP and mySql

Install mysql client in docker image

No definition found for function in vendor vscode

The difference when using if statement true === something() vs something() === true [duplicate]

About Contact Privacy policy Terms and conditions