• 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

woocommerce change position of price

PHP to search within txt file and echo the whole line

PHP - CURL using HTTPS [closed]

jwt decode throws Invalid argument supplied for foreach() on php-jwt and codeignitor 4

Convert every two values of an associative array into key-value pairs

Magento 2 - How to add new block to admin panel in product page?

How to get array values using foreach in laravel

get data-value with variable value

Declaration of OMDb::query(string $statement) must be compatible with PDO::query

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

GA4 custom event from server side, can someone tell me how i can do the following code in php?

How to get multiple values with same key from an array PHP

Converting IPv6 to IPv4 address in PHP

How to remove from a multidimensional array all duplicate elements including the original?

MISSING UPDATES FOR: MEDIA Drupal 9

About Contact Privacy policy Terms and conditions