• 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

XAMPP keeps showing Dashboard/Welcome Page instead of the Configuration Page

Updating and Synchronizing Woocommerce Subscriptions to Custom Date

Batch request Google Calendar php API

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Parameter is not sent to Laravel route in Ajax

MOODLE: What does it mean to aggregate h5p assets?

Laravel Model save() & update() Not Saving

How do I Post to .txt document before form submits

GuzzleHttp Hangs When Using Localhost

Pagekite error: FAIL: localhost:8080 is down

How to show a popup modal in codeIgniter?

Laravel: Why is my variable not being set while it's in the construct function of the controller?

500 (Internal Server Error) with Laravel & Docker [duplicate]

calling server using nusoap with complextype

Split array into 4-element chunks then implode into strings

About Contact Privacy policy Terms and conditions