RE: [PHP] including parenthesis, space and dashes in a phone number



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 it
ADDs the () and -

if ((strlen($phone)) <= 14) $phone =

preg_replace("/[^0-9]*([0-9]{3})[^0-9]*([0-9]{3})[^0-9]*([0-9]
{4}).*/",
"(\\1) \\2-\\3", $phone);
.



Relevant Pages

  • Re: Falafel
    ... you can make a very nice falafel sandwich. ... This same store does sell made up sandwiches like that. ... I also have problems with the pita I buy in the store due to my food allergies. ... I was just looking up recipes for it online but none of those seem to have milk in them. ...
    (alt.support.diabetes)
  • Re: Falafel
    ... and if your local store carries "tahini" sauce (which is ... you can make a very nice falafel sandwich. ... This same store does sell made up sandwiches ... I am wondering about the pita served at a local restaurant. ...
    (alt.support.diabetes)
  • Re: How can you Force "0s" in the field
    ... Try a test table ond only store the numbers not the dashes. ... data is coming from a form place the input mask on it and only store the ...
    (microsoft.public.access.forms)
  • Re: Pita PITA
    ... All the stores used to carry Sahara ... brand, that was good with me ... ... Gee, I think I could cut my pita in half if I was so inclined, and I'm not. ... I wondered about that yesterday when I made a trip to the store for pita for the chicken slouvaki I was making for dinner. ...
    (rec.food.cooking)
  • Re: Storing Data with Input Mask
    ... "Brendan Reynolds" wrote: ... > GlobalSign digital certificate is a forgery and should be deleted without ... I set the wizard to not store the dashes in the ...
    (microsoft.public.access.forms)