• 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

Distribute array row data to make multiple new rows

Vimeo API: how to save a vimeo into a subfolder?

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

Get image type from base64 encoded src string

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

HTML + PHP + PHPMAILER

How to disable widget block editor of WordPress?

How to get unique slug to same post-title for other time too?

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

How to loop a tree array with unknown depth and get array blocks?

Require a class from another class - php

PHP: How to solve ob_start() in combination imagepng() issue?

Confirm Leave on External Links in Wordpress

MySQL/PHP - Web Based Game -User specific inventory table or 1 giant table? Another option?

PHP using str_starts_with for array to exclude same as with wildcard

About Contact Privacy policy Terms and conditions