note 8404 modified in ereg by torben
| From: | torben@php.net | Date: | Sun, 10 Sep 2000 23:02:15 +0000 |
| Subject: | note 8404 modified in ereg by torben | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4683@lists.php.net to get a copy of this message | ||
Some one asked me to add Canadian Postal Code support to http://www.dtheatre.com formmail so I quickly made a function:
<br>
function canadian_postal($zip) {
if (!eregi("^[a-z][0-9][a-z][[:space:]][0-9][a-z][0-9]$", $zip))
echo "Bad";
else
echo "good";
}
$zip = "V1B 1B1";
echo canadian_postal($zip);
<br>
Enjoy!
http://www.php.net/manual/function.ereg.php