• 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

backup files to google drive using PHP

Sentry + Laravel: how to log an already catched Exception?

Add rows to Single product Additional information table in WooCommerce 3.6

merging two arrays with specified index

Laravel eloquent update record without loading from database

Can I write PHP code across multiple lines per statement?

WHERE IN array binding in DB::raw laravel 5.4

Store / Website Column in Magento 2 Admin Grid - Custom Module

Android Volley getParams() method not getting called for JsonObjectRequest

Symfony - EasyAdmin - Add and remove functions are ignored from AssociationField

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

api response laravel doesn't show

Laravel database insert with combining array and string

How can I make good efficent AJAX live forms with just jQuery and

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

About Contact Privacy policy Terms and conditions