• 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

CSV to PHP class properties

Assets not referencing to public folder (Laravel)

Laravel/docker-compose/redis - Class 'Redis' not found

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

How to override htaccees file for cache control header

how to get the header value, if we don't know the value because the value is random from the server

PHP Print to Network Printer

How to debug in WooCommerce 3+

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Laravel display validation error

Losing session data after POST from third party website

Check for PDO Results, If None Display Message, If Yes then Loop Through

How to find phpcs current default standard

add " ? " in url via htaccess RewriteRule

Custom post type single page not working

About Contact Privacy policy Terms and conditions