• 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

Reducing authentication calls on external API (Laravel 5.6)

How do I refresh a DIV content?

How to get values inside <![CDATA[values]] > using php DOM?

How to find the date a user created their Google account

Symfony run hint kernel.secret parameter not found

How to get array values using foreach in laravel

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

Get WooCommerce product variation attribute terms in admin products general box

Increase value by 1 on button click

Dropdown with current value from Mysql

api response laravel doesn't show

PHP mail function is sending blank message body

Not able to override collapsible.js in magento 2

add " ? " in url via htaccess RewriteRule

how to see if database exists with PDO [duplicate]

About Contact Privacy policy Terms and conditions