/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function fnValidatePostal($mValue, $sRegion = '') { 'nl' => 'a', 'ns' => 'b', 'pe' => 'c', 'nb' => 'e', 'mb' => 'r', 'sk' => 's', 'ab' => 't', 'bc' => 'v', 'nt' => 'x', 'nu' => 'x', 'yt' => 'y' ); if (preg_match('/[abceghjlkmnprstvxy]/', $sFirst) && !preg_match('/[dfioqu]/', $mValue) && preg_match('/^\w\d\w[- ]?\d\w\d$/', $mValue)) { { { return true; } { return true; } } { return true; } } return false; }