• 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

Laravel query builder binding parameters more than once

Merge column values from two arrays to form an indexed array of associative arrays

Undefined Array Key error when uploading image on php

dockerizing Laravel + vue

Limit WooCommerce products in cart only from one custom taxonomy

Query Optimization, changing the queries in the loop into a single processing query

Show date difference as "20" instead of "20 years ago"

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

Reading input in php from terminal

Array to string conversion

How to get page number on dompdf PDF when using "view"

Navigation idle on content download

Extract string between first whitespace and last whitespace in php

get folder directory from input type file - PHP

oauth-private.key does not exist or is not readable

About Contact Privacy policy Terms and conditions