• 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

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

Why does codeigniter & Linux server throws unserialize() session data error when user tries to login

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

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

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

Laravel after login Two factor not working

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

PHP only Hit Counter?

Target class controller does not exist - Laravel 8

calling server using nusoap with complextype

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

Laravel - Implicit route model binding with soft deleted data

How to validate Envato Purchase Code in PHP

About Contact Privacy policy Terms and conditions