• 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 can I solve "laravel/horizon v1.1.0 requires ext-pcntl * -> the requested PHP extension pcntl is missing from your system"?

Phalcon: setStatusCode returns empty response

NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)

PHP code for generating decent-looking coupon codes (mix of letters and numbers)

how to create html table in php

How to Display Data in Yajra Datatables Laravel 7?

Pass a select with mysqli_fetch_row to a table

nginx err_connection_refused, can anyone help me?

Combine array with same value and add other [duplicate]

Call to a member function fetch_field() on a non-object MySQLiDB

Make Shipping Method fields Mandatory on Woocommerce checkout page

Remove product downloads section in woocommerce email notifications

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

OctoberCMS / Anonymous Global Scope

PHP Discord OAUTH2 code sample not working

About Contact Privacy policy Terms and conditions