• 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 make dot match newline characters using regular expressions

How to use React Router with Laravel?

How to install PHP composer inside a docker container

Merge key and value of array index [duplicate]

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'posts.post' doesn't exist

Composer Script echo

Yii2: How do I debug console commands?

Appending data to an anchor tag

PHP returning an error message and false

How can I remove the "Advanced" panel of all blocks in WordPress block editor?

How to get the total hour from starting time to end time in php

Read users and passwords from a txt file

Reorder attribute dropdown terms in Woocommerce single variable products

Failed user login on production server using Symfony framework (Authentication request could not be processed due to...)

dockerizing Laravel + vue

About Contact Privacy policy Terms and conditions