• 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

PHP how to detect if running on arm64 cpu?

Correctly determine if date string is a valid date in that format

Unable to run composer install

Pages are working fine on localhost but not running on the hosting server

Laravel update hasMany relationship using saveMany

Saving Data from form to database using AngularJS and php

Cut an arabic string

Query Optimization, changing the queries in the loop into a single processing query

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

Create a new line whenever an array value reaches more than 10 characters

find in set in laravel ? example

using random function but it's displaying duplicates

Laravel Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) on a sub query with "ROW_NUMBER() OVER PARTITION"

Phalcon: setStatusCode returns empty response

browsersync doesn't work with XAMPP

About Contact Privacy policy Terms and conditions