• 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

Handle error for duplicate entries - PHP/MySQL

500 (Internal Server Error) with Laravel & Docker [duplicate]

PHP DOTENV unable to load env vars

How to identify whether webp image is static or animated?

phpunit - mockbuilder - set mock object internal property

Yii2: How to download backup files using spanjeta/yii2-backup?

WAMP Virtual Host not working

PHP random string generator

How to delete old images from public folder on update using Laravel

How to override header set in Apache config with more specific header in a virtual host

WHERE IN array binding in DB::raw laravel 5.4

How to submit the custom form data in database in WordPress without plugin using ajax?

laravel controller function parameters

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

I need to link Google Sheet with my Laravel

About Contact Privacy policy Terms and conditions