Posted By


mukeshdak on 07/25/11

Tagged


Statistics


Viewed 586 times
Favorited by 0 user(s)

Check_for_Valid_indian_Mobile_Number


/ Published in: PHP
Save to your folder(s)

To check if number is valid Indian Mobile Number.


Copy this code and paste it in your HTML
  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. }

URL: http://dak9.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.