• 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 loop a tree array with unknown depth and get array blocks?

get attribute from class not working php 7

Update Order custom Field value with WooCommerce REST API

How to properly start Laravel 8 with Bootstrap & authentication

Calculating Median of an array in PHP

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?

PHPMyAdmin not working as intended at remote server. Error 500, $respond not found

Appending data to an anchor tag

Laravel Sanctum CSRF not authenticating

jQuery Ajax Post with data

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

Laravel 5 issue with wherePivot

How to set dynamic `home` and `siteurl` in WordPress?

How to reset Laravel AuthManager/guards in between API calls in tests?

About Contact Privacy policy Terms and conditions