• 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

Sort multidimensional array by column value within a column

Modify microseconds of a PHP DateTime object

Laravel: Create morphs() relationship nullable

Cant seem to get the Pagination to work on my WooCommerce REST API application?

PHP Get value from JSON [duplicate]

Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::fetch_assoc() [duplicate]

Laravel get user data with profile

Make Shipping Method fields Mandatory on Woocommerce checkout page

php - add comma thousands separator but remove trailing zeros

PHP echo values of all sub keys [duplicate]

How to get page number on dompdf PDF when using "view"

Prestashop webservice API creating cart rules

merge all files in directory to one text file

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

SQLSTATE[HY000]: General error: 1 table posts has no column named *

About Contact Privacy policy Terms and conditions