• 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 remove %20 in the url in php

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

PHP's array_map including keys

Connecting an HTML webpage to a SQL Server

Add 2 Webcam in one page with WebcamJS

Limit of log line written to Apache Errorlog from mod php error_log

Image upload not working through ajax Laravel

JSON Render Issue in Date Object Laravel and PHP 7.4

Adding Multiple Custom Post Types in Wordpress

Laravel websockets AWS EC2 - Connection failed

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

How to debug in WooCommerce 3+

Xdebug 3 not showing in phpinfo on m1 Monterey

Post Form Data To phpmyadmin Database

Why does using salted hash on python and php give me different results?

About Contact Privacy policy Terms and conditions