• 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

Alert message after submitting form in PHP

How can i call a function that executes an fpdf based on the choice of a form selector?

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

Woocommerce Edit Message "An account is already registered with your email address. Please log in."

PHP's array_map including keys

CodeIgniter 4: Like and Dislike Functionality

How to remove index.php and index from the URL using htaccess | PHP

Popup Window and PHP form

XDebug not working in VScode for php debugging

Appending data to an anchor tag

VichUploaderBundle error "Expected argument of type "File", "NULL" given" when submitting the form without selecting any file

Comma separated list from array with "and" before last element

Custom post type single page not working

generating a random code in php?

Insert multidimensional array to codeigniter cart

About Contact Privacy policy Terms and conditions