function check_IBAN($iban) { $machine_iban = iban_to_machine_format($iban); if (verify_iban($machine_iban)) { $array['result'] = false; $array['human_IBAN'] = iban_to_human_format($machine_iban); echo json_encode($array); } else { $array['result'] = true; $array['message'] = "Nesprávny iban"; echo json_encode($array); } }
print "OK.\n"; } print " - SWIFT official check for 'VG'... "; if (!iban_country_get_country_swift_official('VG')) { print "FAILED.\n"; exit(1); } else { print "OK.\n"; } # === iban_to_human_format =================================== # case of already in human format (unofficial country) $test_data = array('AA11 0011 123Z 5678' => 'AA11 0011 123Z 5678', 'VG96VPVG0000012345678901' => 'VG96 VPVG 0000 0123 4567 8901', ' VG96VPVG0000012345678901 ' => 'VG96 VPVG 0000 0123 4567 8901'); $i = 0; foreach ($test_data as $input => $expected_output) { print " - iban_to_human_format() test #{$i}... "; $received_output = iban_to_human_format($input); if ($received_output != $expected_output) { print "FAILED (expected '{$expected_output}', received '{$received_output}')\n"; exit(1); } else { print "OK.\n"; } $i++; } # === iban_get_nationalchecksum_part ======================== $test_data = array('AL47212110090000000235698741' => '9', 'ES9121000418450200051332' => '45', 'BE68 5390 0754 7034' => '34'); $i = 0; foreach ($test_data as $input => $expected_output) { print " - iban_get_nationalchecksum_part() test #{$i}... "; $received_output = iban_get_nationalchecksum_part($input); if ($received_output != $expected_output) {
# get country code $countrycode = $country['country']; # start section print "[{$countrycode}: " . iban_country_get_country_name($countrycode) . "]\n"; # output remaining country properties print "Is a SEPA member? "; if (iban_country_is_sepa($countrycode)) { print "Yes"; } else { print "No"; } print ".\n"; # get example iban $iban = $country['iban_example']; # output example iban properties one by one print "Example IBAN: " . iban_to_human_format($iban) . "\n"; print " - country " . iban_get_country_part($iban) . "\n"; print " - checksum " . iban_get_checksum_part($iban) . "\n"; print " - bban " . iban_get_bban_part($iban) . "\n"; print " - bank " . iban_get_bank_part($iban) . "\n"; print " - branch " . iban_get_branch_part($iban) . "\n"; print " - account " . iban_get_account_part($iban) . "\n"; # output all properties #$parts = iban_get_parts($iban); #print_r($parts); # verify print "\nChecking validity... "; if (verify_iban($iban)) { print "IBAN {$iban} is valid.\n"; } else { print "ERROR: IBAN {$iban} is invalid.\n";
public function HumanFormat() { return iban_to_human_format($this->iban); }