India Phone Number Validation Script

India Phone Number Validation Script is use to validate india telephone number through regular expression.

Demo :



India telephone number :    

Example :

Just type a proper India phone number like this (022) 22881111 and click check button Is a properly-formatted india phone number message will display otherwise type a 12346 number at textbox and click check button Is an improperly - formatted india phone number will display here.

Code :

Following code is use to India Phone Number Validation Script if you need to copy and use to your website.


<?php
function validateIndiaPhone($str)
{
  return preg_match("/^\(0\d{2}\)\s?\d{8}$/", $str);
}
  $india_phone_no = "(022) 22881111";
  echo validateIndiaPhone($india_phone_no) ? "Is a properly-formatted India phone number" : "Is an improperly-formatted India phone number";
?>

In the above $india_phone_no variable is use to assign the phone number. In the validateIndiaPhone() function is use to check the validate India telephone number through regular expression.

Free Download Script :

If you need to India Phone Number Validation Script click and download from following link.

Download




Content