Return to Snippet

Revision: 49548
at July 25, 2011 01:33 by mukeshdak


Initial Code
// PHP Function below can be used to check 
// if a given number is valid Indian mobile number or not.
function is_mobile($number)
{
	$result = true;
	// unless prooved otherwise, mobile number is valid.
	
	$number = preg_replace('/\D/', '', $number);
	// Strip out non digits.

	$first_digit = substr($number,0,1);	
	if( strcmp($first_digit,"6") < 0 )	$result = false;
	// first digit should be greater then 6.

	if(strlen("$number") != 10)			$result = false;
	// Should be of exactl ten digits.
	
	return $result;
}

Initial URL
http://dak9.com

Initial Description
To check if number is valid Indian Mobile Number.

Initial Title
Check_for_Valid_indian_Mobile_Number

Initial Tags
mobile

Initial Language
PHP