You are here

function _postal_code_validation_validate_DK in Postal Code Validation 7

Implements _postal_code_validation_validate_COUNTRYCODE().

File

countries/dk.inc, line 11
Postal code validation functions for Denmark.

Code

function _postal_code_validation_validate_DK($postal_code) {
  $return = array(
    'country' => 'DK',
  );
  if (preg_match('/^[1-9][0-9]{3}$/', $postal_code)) {
    $return['postal_code'] = $postal_code;
  }
  else {
    $return['error'] = t('Invalid postal code. Postal codes in Denmark are like "9999" and never start with zero.');
  }
  return $return;
}