public static function isIban($value)
{
// build replacement arrays
$iban_replace_chars = range('A', 'Z');
foreach (range(10, 35) as $tempvalue) {
$iban_replace_values[] = strval($tempvalue);
}
// prepare string
$tempiban = strtoupper($value);
$tempiban = str_replace(' ', '', $tempiban);
// check iban length
if (self::getIbanLength($tempiban) != strlen($tempiban)) {
return false;
}
// build checksum
$tempiban = substr($tempiban, 4) . substr($tempiban, 0, 4);
$tempiban = str_replace($iban_replace_chars, $iban_replace_values, $tempiban);
$tempcheckvalue = intval(substr($tempiban, 0, 1));
for ($strcounter = 1; $strcounter < strlen($tempiban); $strcounter++) {
$tempcheckvalue *= 10;
$tempcheckvalue += intval(substr($tempiban, $strcounter, 1));
$tempcheckvalue %= 97;
}
// only modulo 1 is iban
return $tempcheckvalue == 1;
}