#$parts = $myIban->Parts();
#print_r($parts);
# verify
print "\nChecking validity... ";
if ($myIban->Verify()) {
print "IBAN {$myIban->iban} is valid.\n";
} else {
print "ERROR: IBAN {$myIban->iban} is invalid.\n";
$correct = $myIban->SetChecksum();
if ($correct == $iban) {
print " (checksum is correct, structure must have issues.)\n";
$machine_iban = $myIban->MachineFormat();
print " (machine format is: '{$machine_iban}')\n";
$country = $myIban->Country();
print " (country is: '{$country}')\n";
$myCountry = new IBANCountry($country);
if (strlen($machine_iban) != $myCountry->IBANLength()) {
print " (ERROR: length of '" . strlen($machine_iban) . "' does not match expected length for country's IBAN '" . $myCountry->IBANLength() . "'.)";
}
$regex = '/' . $myCountry->IBANFormatRegex() . '/';
if (!preg_match($regex, $machine_iban)) {
print " (ERROR: did not match regular expression '" . $regex . "')\n";
}
} else {
print " (correct checksum version would be '" . $correct . "')\n";
}
$errors++;
}
print "\n";
}
exit($errors);