>I need to show up some data from a DB which consist of phone numbers >with area code. They’re stored like (xxxx) xxxxxxxx. What is the best >approach to print them into some textboxes so they can be edited? I’m >using substr but area codes (inside parenthesis) goes from 3 to 5 >numbers, so sometimes the closing parenthesis is showed and other times >even the first number from the actual number is also showed. Can I use >regex instead? How is it used? I tried to figure it out in the PHP >manual, but it is NOT written in my level of English.
Ya know what? *UNLESS* you are using SQL to figure out who's in which area code, and match up their distances or something, just leave it all in one field, and let the humans figure out what the () and - and x and + mean in: +(054)-123-4567x89 +54(123)4567 ext 89 +54-123-4567 e 89 Because, really, there is no point in working really hard at this, when sooner or later, you'll have somebody who insists on using: 1-800-MY-STUFF instead of the numbers. Or they'll insist that their phone number have more digits than you planned. Or you'll need to support phone numbers in Outer Mongolia where they don't use the system you support Or... There are a billion ways for this to "go wrong" and make you re-write your code every year or so. Don't do it. If you *are* using the digits to figure out who's where and match up area codes, ignore me. :-) Actually, you *might* be better off to let a human enter what they want, and then *YOU* figure out the area code later or something... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php