> 123 4567
> 1234567
> +91 44 123 4567
> +91 44 1234567
> 91-44-123 4567
> 91-44-1234567

So, 91441234567 and 9 1 4 4 1 2 3 4 5 6 7 aren't valid?

You *could* apply a rule here, but it's fallible.

1. Strip out everything thats not a number (ereg_replace("[^0-9]", "")).

2. Count the number of digits.
   a. If there's less than 7 digits, its invalid.
   b. 7 digits is valid, local number format.
   c. 8, 9, and 10 digit numbers are invalid.
   d. 11 digits is valid, international format.

Of course, if someone has a mobile phone this will fall flat on its
face (in Australia, our phone numbers have 8 digits and our mobiles
have 10 digits - this is the same in a number of countries).

My advice, check that there's at least 7 digits and let it go.

Jason

-- 
Jason Murray
[EMAIL PROTECTED]
Web Design Team, Melbourne IT
Fetch the comfy chair!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to