excluding parenthesis, space and dashes from phone number
- From: afan@xxxxxxxx (afan pasalic)
- Date: Fri, 30 Nov 2007 08:44:38 -0500
hi,
I store phone number in mysql as integer, e.g. (123) 456-7890 is stored
as 1234567890.
though, in search form they usually type in a phone number with
parenthesis/space/dashes. I have to extract numbers before I search
through mysql.
currently, I use eregi_replace() function, several times, to do the job:
eregi_replace(' ', '', $phone);
eregi_replace('(', '', $phone);
eregi_replace(')', '', $phone);
eregi_replace('-', '', $phone);
and it works fine.
but, is there any better way? more "fancy"? :)
thanks for any help.
-afan
.
- Follow-Ups:
- RE: [PHP] including parenthesis, space and dashes in a phone number
- From: "Daevid Vincent"
- Re: [PHP] excluding parenthesis, space and dashes from phone number
- From: Zoltán Németh
- Re: [PHP] excluding parenthesis, space and dashes from phone number
- From: Jochem Maas
- RE: [PHP] including parenthesis, space and dashes in a phone number
- Prev by Date: Re: Question about urlencode....
- Next by Date: Re: [PHP] Join question
- Previous by thread: Singletons in PHP
- Next by thread: Re: [PHP] excluding parenthesis, space and dashes from phone number
- Index(es):
Relevant Pages
|