You are here

function _postal_code_validation_validate_PL in Postal Code Validation 7

Implements _postal_code_validation_validate_COUNTRYCODE().

File

countries/pl.inc, line 11
Postal code validation functions for Poland.

Code

function _postal_code_validation_validate_PL($postal_code) {
  $return = array(
    'country' => 'PL',
  );
  if (preg_match('/^([0-9]{2})(-[0-9]{3})?$/', $postal_code, $matches)) {
    $return['postal_code'] = $postal_code;
  }
  else {
    $return['error'] = t('Invalid postal code. Postal codes in Poland are like "33-170".');
  }
  return $return;
}