• 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

Creating a config file in PHP

"cannot list resources" error from WooCommerce REST API

401 Unauthorized only occurring on some pages in Laravel 8

sort() not affecting original array while inside foreach loop

CodeIgniter 3 is generating a session file on each request, why?

Telegram bot doesn't answer

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

How to get Laravel's CSRF Token from Another Website?

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Laravel 8: Array to string conversion while calling route:list

How to get page number on dompdf PDF when using "view"

Load a .env file with PHP

PHP -> Next nearest date defined by array of days in week

Add a custom text for a particular product on specific email notification in Woocommerce

WordPress Security Standards want me to escape my html, but how to do it correctly?

About Contact Privacy policy Terms and conditions