• 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

how to create html table in php

Laravel: HTML in notification

Explain how this array transposing and flattening function works

Unit (real unit test) of test laravel relationship

How to remove from a multidimensional array all duplicate elements including the original?

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

Submitting a form with ajax in Wordpress

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

Message: Set sys_temp_dir in your php.ini after installed composer

Merge column values from two arrays to form an indexed array of associative arrays

Login if user is active using Laravel Breeze

Correct way to use LIKE '%{$var}%' with prepared statements?

Which is faster php date functions or carbon?

Laravel unique validation on multiple columns

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

About Contact Privacy policy Terms and conditions