RE: [PHP] including parenthesis, space and dashes in a phone number
- From: daevid@xxxxxxxxxx ("Daevid Vincent")
- Date: Sun, 2 Dec 2007 15:28:32 -0800
I should have been more clear. I do *store* the numbers sans punctuation, but that's trivial to accomplish as we've seen. I do like to display it however with the nice parens and hyphens. Hence "opposite". :)
-----Original Message-----.
From: afan pasalic [mailto:afan@xxxxxxxx]
Sent: Friday, November 30, 2007 12:03 PM
To: Daevid Vincent
Cc: 'php-general'
Subject: Re: [PHP] including parenthesis, space and dashes in
a phone number
It's ok to store it this way, but it could be a little PITA
when search.
E.g., you store (123) 456-7890 and somebody search for
123-456-7890? Right?
-afan
Daevid Vincent wrote:
The kind of OPPOSITE of this, is what I use, in that itADDs the () and -
preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]
if ((strlen($phone)) <= 14) $phone =
{4}).*/",
"(\\1) \\2-\\3", $phone);
- Prev by Date: RE: [PHP] including parenthesis, space and dashes in a phone number
- Next by Date: Re: [PHP] sprintf() oddness
- Previous by thread: RE: [PHP] including parenthesis, space and dashes in a phone number
- Next by thread: Re: [PHP] Calling a stored procedure
- Index(es):
Relevant Pages
|