Hi All,
Here is something that might help the community. I have developed a function which can parse and read most any US/Canada phone number.
- The location is http://www.relatebase.com/development/misc/phone_parser.php
The function returns false if phone appears not to be valid. The function name is valid_phone(); it returns an array $valid_phone if successful, which is a breakdown of all components of the phone. Give it a try!
Would anyone be willing to take this and test it OR, what I'd really like, add international number support? Now I have this set to work in the US, and I'd like to recognize international numbers and parse out the country code as well.
This function was written based on US/Canada phone numbers of format NNN-NNN-NNNN. If someone wanted to really be adventurous, the structure of a phone number vs. the country could be set in an array, and a switch could be passed so that the function would think as if receiving british phone numbers, etc.
Thanks for your interest, the function is free without restrictions if you need it.
Sam Fullman
Compass Point Media