• 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

Get WooCommerce products from specific category

Store / Website Column in Magento 2 Admin Grid - Custom Module

PHP how to detect if running on arm64 cpu?

Laravel SQL query midnight time not showing

How to override header set in Apache config with more specific header in a virtual host

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

"Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

Cant seem to get the Pagination to work on my WooCommerce REST API application?

Laravel post contact form giving me error 419

How to create a individual template for page or post in custom plugin?

Docker & Laravel : configure: error: Package requirements (oniguruma) were not met

How can I easily switch between PHP versions on Mac OSX?

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

How to add a heading in between checkout fields of WooCommerce

How to check user Permissions using Custom Middleware in Laravel

About Contact Privacy policy Terms and conditions