• 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) How to delete multiple models including optional relationships?

Performance of foreach, array_map with lambda and array_map with static function

Pass a select with mysqli_fetch_row to a table

"cannot list resources" error from WooCommerce REST API

Custom post type single page not working

Installing Composer - Internal Error

selected value from the listbox in php

PHPExcel How to set conditional formatting to change cell background color based on cells values

zsh: command not found: php

How to test laravel controller method?

How to get multiple values with same key from an array PHP

Assets not referencing to public folder (Laravel)

Use Python plotly chart in PHP

Laravel csrf token mismatch for ajax POST Request

Stop caching for PHP 5.5.3 in MAMP

About Contact Privacy policy Terms and conditions