• 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

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

Can't find vendor/autoload.php for Ratchet

How to auto populate preferredCountries from intl-tel-input with db output

Laravel Delete and Update

Batch request Google Calendar php API

Laravel Gates using model and returns "Using $this when not in object context" Line 28 of AzureUser model

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

Dropzone: Submit both form data and dropzone at once

Laravel 4 Redirect::back() not going to previous page (refreshing current page)

Submitting a form with ajax in Wordpress

PHPMetrics option --excluded-dirs="myfolder" : myfolder dir is not excluded within docker

Get all WooCommerce products within own plugin

How to add automatically collapse/expand in content wordpress (single.php)?

How to read laravel_session cookies saved in cookie memory of browser in client side?

Refresh specific HTML content that retrieves data from MySQL

About Contact Privacy policy Terms and conditions