Wednesday
7
January
2009

Validating IBAN numbers

Hy fellows,

for those of you who have to work with bank accounts and money transfer I just added a IBAN validator.
IBAN stands for International Bank Account Number and is actually known to be used in 39 countries.

It’s usage is simple as the usage of every validator:

$validator = new Zend_Validate_Iban();
$iban = 'AT611904300234573201';
if ($validator->isValid($iban)) {
    // IBAN appears to be valid
} else {
    // IBAN is invalid
    foreach ($validator->getMessages() as $message) {
        echo "$messagen";
    }
}

It validates the country (AT), the format (every country uses a different IBAN format) and also the IBAN checksum which is provided within the IBAN string.

I hope you find it usefull and when you are missing anything related to money transfer and bank accounts don’t be shy and write a issue or a mail to me.

Happy frameworking

Greetings
Thomas Weidner
I18N Team Leader, Zend Framework

Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework

Back to top