> > Is there a routine out there to strip all characters from a phone
> > number except the numbers? I was going to write my own but
> > figured there must already be one out there I can use. Thanks.
>
> While the solution given will work, consider the following perfectly valid
> phone numbers:
>
> 312-555-1234x1001
> 1-800-MY-STUFF
>
> Also, once you strip out all the spaces and dashes, nobody but a computer
> can use it...
>
> Do you *really* want to make it difficult for humans to use?
True, but there are situations where it's handy to convert things like this
purely into numbers.. I use PHP to retrieve telephone numbers from a DB and
display them in a wml file... so that when a user finds an entry in the db
that they like, they've an option to hit the 'call' link, the phone
automatically disconnects the user from the net and dials up the business'
number.
Unfortunately, there are a number of pitfalls with this... some of the
telephone numbers in the db were entered with the area code, some weren't..
so some replacements there were required..
then there's the fact that you can only call the businesses when in the UK -
I didn't get around to converting the numbers into anything other than valid
numbers for calls within the UK.
Another downside is the fact that mobiles work differently from one
another - so the "hangup from the net and dial the telephone number" button
only seemed to work on Nokia phones.
Luckily, we don't use the letters in telephone numbers in the UK - which was
one less headache. Though all of the other problems with what I was working
on has meant that it never got past alpha testing ;)
James.
--
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]