• 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

Toggle between a textbox and a select using PHP

Project structure for PHP

How to create laravel storage symbolic link for production or sub domain system?

Doctrine 2 mapping referencing unique key

Laravel multi auth - Authentication user provider [] is not defined

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

Ajax GET request fails in laravel 8

Reducing authentication calls on external API (Laravel 5.6)

How to set time with DateTime modify?

How can I make this nested location configuration use the correct path to call a php program?

Phpunit partial mock + proxy Entity

Laravel whole batch is cancelled if one Job fails

How to set dynamic `home` and `siteurl` in WordPress?

Laravel: Create morphs() relationship nullable

How to fix 'Data has already been sent to output, unable to output PDF file' in MPDF

About Contact Privacy policy Terms and conditions