- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Makes sense to me. He uses delimiters to test the data effectively field by field and then stores it without delimiters for dialing purposes. Its not really worth the effort because he doesn't actually report which field is flawed, but I suppose the seed to grow from is definitely there. Not how I would have done it, but then, I would never have used PHP in the first place.
Admin
<FONT size=2>What the hell is wrong with you people? </FONT>
<FONT size=2>Let's assume you have a single box to enter the phone (not the stupid 3-box scheme, but if you insist on that abomination just do <FONT face="Courier New">$phone = $phone1.$phone2.$phone3 <FONT face="Times New Roman">first</FONT></FONT>)</FONT>
<FONT face="Courier New" size=2>$phone_is_valid = preg_match("/^\d{10}$/", preg_replace("/\D/", "", $phone));</FONT>
<FONT size=2>In other words, strip all non-digit chars from the phone field, and if the resulting string isn't a 10-digit string, you have a problem.</FONT>
<FONT size=2>Gee-fookin'-zus. No wonder sites like this exist.</FONT>