You are here

function _postal_code_validation_validate_KZ in Postal Code Validation 7

Implements _postal_code_validation_validate_COUNTRYCODE().

File

countries/kz.inc, line 11
Postal code validation functions for Kazakhstan.

Code

function _postal_code_validation_validate_KZ($postal_code) {
  $return = array(
    'country' => 'KZ',
  );
  if (preg_match('/^[01][0-9]{5}$/', $postal_code)) {
    $return['postal_code'] = $postal_code;
  }
  else {
    $return['error'] = t('Invalid postal code. Postal codes in Kazakhstan are like "999999" and must start with 0 or 1.');
  }
  return $return;
}