• 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

Group rows by column and sum another column within groups [duplicate]

Unit (real unit test) of test laravel relationship

Laravel implode array items to new lines

I want to display default profile image if user do not have profile image

wp_remote_get() not passing authentication

Execute only one time and then wait set period of time before executing again

Render the content of default_filter.php in Joomla front-end

Phpunit partial mock + proxy Entity

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

PHP web3 ERC20 token function call

laravel automatically deletes server.php on php artisan serve

Alert message after submitting form in PHP

how to loop through json response data using ajax jquery?

Add a text next to stock quantity if it is less than 10 in Woocommerce single product

selected value from the listbox in php

About Contact Privacy policy Terms and conditions