• 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

Dropdown with current value from Mysql

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Message: Set sys_temp_dir in your php.ini after installed composer

Required field only if another field has a value, must be empty otherwise

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

Unable to Edit config.inc.php

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

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

html-php form submission after validation through JavaScript [closed]

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

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

Correct way to use LIKE '%{$var}%' with prepared statements?

Limit WooCommerce products in cart only from one custom taxonomy

PHP: How to solve ob_start() in combination imagepng() issue?

how to loop through json response data using ajax jquery?

About Contact Privacy policy Terms and conditions