Skip to content
elcapo edited this page Oct 16, 2014 · 3 revisions

getIBANCheckDigits This function expects the entire account number in the electronic format (without spaces), as described in the ISO 13616-Compliant IBAN Formats document.

You can replace check digits with zeros when calling the function.

Usage

/* MySQL */
SELECT getIBANCheckDigits( 'GB00WEST12345698765432' ); /* Returns 82 */
/* JavaScript */
var CD = getIBANCheckDigits( 'GB00WEST12345698765432' ); /* CD = 82 */
/* PHP */
$CD = getIBANCheckDigits( 'GB00WEST12345698765432' ); /* $CD = 82 */

Return values

  • [string] - Check digits corresponding to the received IBAN.
  • [empty] - Empty if the input string didn't fit the IBAN pattern.

Dependencies

In order to verify the first two digits of the input string, this function uses isSepaCountry. In order to verify the length of the string, this function uses getAccountLength. In order to properly run the algorithm that prepares the string and calculates the check digits, this function uses replaceLetterWithDigits.

Category

This function is part of the [International Bank Account Numbers (IBAN)](International Bank Account Numbers (IBAN)) package.

SEPA validations

  • [International Bank Account Numbers (IBAN)](International Bank Account Numbers (IBAN))

Spanish validations

Helpers

  • [Common functions](Common functions)
Clone this wiki locally