public function Verify($iban = '')
 {
     $_iban = str_replace(' ', '', $iban);
     _iban_load_registry();
     return parent::Verify($_iban);
 }
Example #2
0
            # check the 'all occurrences of <char> were mistranscribed' case
            foreach ($_iban_mistranscriptions[$char] as $possible_origin) {
                $possible_iban = str_replace($char, $possible_origin, $incorrect_iban);
                if (verify_iban($possible_iban)) {
                    array_push($suggestions, $possible_iban);
                }
            }
        }
    }
    return $suggestions;
}
##### internal use functions - safe to ignore ######
# Load the IBAN registry from disk.
global $_iban_registry;
$_iban_registry = array();
_iban_load_registry();
function _iban_load_registry()
{
    global $_iban_registry;
    # if the registry is not yet loaded, or has been corrupted, reload
    if (!is_array($_iban_registry) || count($_iban_registry) < 1) {
        $data = file_get_contents(dirname(__FILE__) . '/registry.txt');
        $lines = explode("\n", $data);
        array_shift($lines);
        # drop leading description line
        # loop through lines
        foreach ($lines as $line) {
            if ($line != '') {
                # split to fields
                $old_display_errors_value = ini_get('display_errors');
                ini_set('display_errors', false);
 public function __construct($code = '')
 {
     parent::__construct($code);
     _iban_load_registry();
 }
function _iban_country_get_info($country, $code)
{
    _iban_load_registry();
    global $_iban_registry;
    $country = strtoupper($country);
    $code = strtolower($code);
    if (array_key_exists($country, $_iban_registry)) {
        if (array_key_exists($code, $_iban_registry[$country])) {
            return $_iban_registry[$country][$code];
        }
    }
    return false;
}