• 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

get attribute from class not working php 7

How to Create WooCommerce Subscription Product via. REST API?

Xdebug can't connect back to Docker host

Respond with status code 401 on authentication failure using Laravel and Passport?

sqlsrv_num_rows() expects parameter 1 to be resource, boolean given

Add customer email and phone in "Order" column to admin orders list on Woocommerce

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Laravel 8 Multiple Relationships for Factory

Insert And Retrieve Data in MySQL with $.post Noob Question

Laravel Multi-language routes without prefix

Get image type from base64 encoded src string

Send same name multiple checkbox values via ajax

Attempted to call an undefined method named "get" of class "MailController"

laravel 5.6 bulk inserting json data

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

About Contact Privacy policy Terms and conditions