ZF1.12 : Zend_Validate_Iban, supported countries

Posted: December 19, 2013 in PHP, ZF
Tags: , , ,

Often asked to me: “what is the list of countries you test for IBAN”. Most of the time, a simple “I let the framework doing it, don’t know what and how, it works” is enough. This morning, it wasn’t… !

So, if you had the same question, here is the list of supported countries within the Zend Framework 1.12:

  • AD, AT,
  • BA, BE, BG,
  • CH, CS, CY, CZ,
  • DE, DK,
  • EE, ES,
  • FR, FI,
  • GB, GI, GR,
  • HR, HU,
  • IE, IS, IT,
  • LI, LU, LT, LV,
  • MK, MT,
  • NL, NO,
  • PL, PT,
  • RO,
  • SE, SI, SK,
  • TN, TR.

Any country not in this list, will raise the error Zend_Validate_Iban::NOTSUPPORTED. For the others, a regular expression is applied. For instance, here is the one for France:

'/^FR[0-9]{2}[0-9]{10}[A-Z0-9]{13}$/'

This “sentence” means: begins with ‘FR’, followed by 2 figures, then 10 figures and lasts with 13 alphanumeric characters (will raise a Zend_Validate_Iban::FALSEFORMAT error in case it doesn’t match).

Finally, the IBAN key is checked (will raise a Zend_Validate_Iban::CHECKFAILED error).

Voilà :).

Next post : how to add the list of new implemented countries in ZF2…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s