For the purposes of readability and reusability. PHP may try to make these coding staples as awkward as possible, but at least we've still got the good old function available to us.![]()
For the purposes of readability and reusability. PHP may try to make these coding staples as awkward as possible, but at least we've still got the good old function available to us.![]()
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
Heres a tested function to check all US zipcodes:
PHP Code:<?php
function validate_zip($zipcode){
return preg_match('/^[0-9]{5}([- ]?[0-9]{4})?$/', $zipcode);
}
?>
Bookmarks