• 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

Detect if PHP session exists

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

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

PHP file_get_contents function

Additional price based on cart item count in WooCommerce

Popup Window and PHP form

Losing session data after POST from third party website

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

How to give apache permission to write to home directory?

How to change product Image when variables are selected in Shop and Archive Pages?

Get WooCommerce product variation attribute terms in admin products general box

correct PHP headers for pdf file download

Server-sent events in PHP (without echo or print)

Project structure for PHP

Adding multiple items to WooCommerce cart at once

About Contact Privacy policy Terms and conditions