• 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

java URL working on browser but not in client program

Why i get wrong output for html markdown?

Laravel PHP: multiple project run at the same time [closed]

Laravel websockets AWS EC2 - Connection failed

Why isn't my PHP exception working?

How to get the total hour from starting time to end time in php

How to change product Image when variables are selected in Shop and Archive Pages?

passwordless LDAP login and get user information using Kerberos ticket in PHP

Laravel 5 session not persisting after user is logged in

how to use extended ASCII instead of unicode in PHP

How to use React Router with Laravel?

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

How to add a sidebar to Woocommerce Shop Page?

Accessors (Getter) & Mutators (Setter) On a Pivot Table in Laravel

I want to display default profile image if user do not have profile image

About Contact Privacy policy Terms and conditions