• 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

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

How can I make Laravel return a custom error for a JSON REST API

Laravel Delete and Update

laravel automatically deletes server.php on php artisan serve

Artisan, creating tables in database

Ajax GET request fails in laravel 8

MongoDB Duplicate Documents even after adding unique key

Use same method for inertia response and json response Laravel Jetstream

CodeIgniter 3 is generating a session file on each request, why?

Distribute array row data to make multiple new rows

could not find driver Debian SQL Server PHP

html-php form submission after validation through JavaScript [closed]

PHP mail function is sending blank message body

Convert regular text to array using notepad++

Laravel - Implicit route model binding with soft deleted data

About Contact Privacy policy Terms and conditions