note 8404 added to ereg
| From: | joe at dtheatre dot com | Date: | Sun, 10 Sep 2000 22:55:18 +0000 |
| Subject: | note 8404 added to ereg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4682@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 candian_postal($zip) {
if (!ereg("^[a-zA-Z][0-9][a-zA-Z][[:space:]][0-9][a-zA-Z][0-9]$", $zip))
echo "Bad";
else
echo "good";
}
$zip = "V1B 1B1";
echo candian_postal($zip);
<br>
Enjoy!
http://www.php.net/manual/function.ereg.php