Posted By

mukeshdak on 07/25/11


Tagged

valid check mobile Indian mukeshdak


Versions (?)

Check_for_Valid_indian_Mobile_Number


 / Published in: PHP
 

URL: http://dak9.com

To check if number is valid Indian Mobile Number.

  1. // PHP Function below can be used to check
  2. // if a given number is valid Indian mobile number or not.
  3. function is_mobile($number)
  4. {
  5. $result = true;
  6. // unless prooved otherwise, mobile number is valid.
  7.  
  8. $number = preg_replace('/\D/', '', $number);
  9. // Strip out non digits.
  10.  
  11. $first_digit = substr($number,0,1);
  12. if( strcmp($first_digit,"6") < 0 ) $result = false;
  13. // first digit should be greater then 6.
  14.  
  15. if(strlen("$number") != 10) $result = false;
  16. // Should be of exactl ten digits.
  17.  
  18. return $result;
  19. }

Report this snippet  

You need to login to post a comment.