Re: Restore Leading Zeros in Zip Codes
| From: | tedd | Date: | Fri, 22 Aug 2008 21:16:40 +0000 |
| Subject: | Re: Restore Leading Zeros in Zip Codes | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278548@lists.php.net to get a copy of this message | ||
At 12:35 PM -0400 8/22/08, Dan Joseph wrote:
tedd wrote:Back-side I told the OP to convert to sting, add zeros to the left, and left-trim as necessary. There is much more here than what meets the eye with international addresses. As a word of caution, don't make anything a number and also open address forms to accept multiple strings for international addressing. There's a big world out there of people who don't conform to what we think is the "standard". Remember, if you speak/write English then you're only 4 percent of the world's population. We're hardly the "standard" for anything. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.comFrom a recent experience, you should all listen to Tedd's advice. I inhereited an application when I came to work at my current job where the developer used an INT(11) mysql column type for zipcodes. Its turned things into a nightmare. We pulll quotes based off distance and calculate that off zip codes. First I found that there are some 4 digit zip codes in other counties, and shipping from Ohio to New Jersey quotes were coming up as thousands of miles and thousands of dollars, when they shouldn't have. Then there was the announcement of expanding into Canada. Then came digging thru all the code trying to redo how zip codes are happening, and ultimately its lead to a rewrite of the system. Do yourself a favor, and use a string type, fix the ones you have with a sprintf() function and be glad you won't have to suffer in the future. -- -Dan JosephWhy take them out in the first place? Keep the zip code as a string. After all, not all countries use just numbers.