Yes,

I found some examples in the archives that measured a clean string and
formatted it according to whether it found 4 (is an error), 7 (xxx-xxxx), 10
(xxx-xxx-xxxx) or 11 (x-xxx-xxx-xxxx). I'm going to work with this sort of
logic and standardize the format (or maybe just the length of string) before
inserting into my db. I haven't completely decided if it's better to store
1234567890 and format it on retrieval or to format it first and store
123-456-7890. I guess unless I plan to do math or something with the raw
data later (not too likely for a phone number), it probably doesn't make
much difference.

Thanks again :)


On 8/10/03 2:25 PM, "John W. Holmes" <[EMAIL PROTECTED]> wrote:

> After you replace all of the non numeric characters, if the length is 7,
> you can add the default area code.

> Verdon vaillancourt wrote:
> 
>> Thanks John,
>> 
>> That does look a lot tidier. I tried a similar approach early on, but was
>> trying to specifically match '(' and ')' and was running into lots of
>> trouble with my syntax, in specific, properly escaping \( and \) so they
>> were not treated as paranthesis/operators/whatever. This is much simpler. I
>> like simple :)
>> 
>> Now I can focus on inserting a default area code, if the user does not ;)
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to