• 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

Parameter is not sent to Laravel route in Ajax

How to fix this error : Ask your hosting provider to use PHP 7.2.5 or higher for both HTTP and CLI?

PHP SoapClient: set a namespace without prefix

find in set in laravel ? example

How to pass data to all views in Laravel 5?

Get WooCommerce products from specific category

echo language construct is discouraged. (PHP)

how to display a view on laravel 8 and not have a 404 NOT FOUND page?

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

Creating live search with AJAX and CodeIgniter

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

Laravel Pagination links() not working

Array to string conversion

Appending data to an anchor tag

Pagekite error: FAIL: localhost:8080 is down

About Contact Privacy policy Terms and conditions