• 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

How avoid Moved Permanently The document has moved here

Woocommerce Checkout - Add conditional field required if one field is filled

Get data from accuweather api url

send email using gmail-api and google-api-php-client

Match single unknown parameter php (Morse-code Regex)

Get all WooCommerce products within own plugin

How do I Post to .txt document before form submits

WooCommerce Additional Information - if empty, hide

loop through an anchor id

How to upload mpdf file after generating to s3 bucket in php

Xdebug can't connect back to Docker host

Spam Filter in Contact Form

How to get quarter for future date using Carbon?

Pass an image through AJAX [duplicate]

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

About Contact Privacy policy Terms and conditions