=

Daschmi's Notizblog

RSS Feed

IBAN Validieren

Erstellt in PHP am 11. März 2014

Mit folgendem PHP Code Schnipsel kann man einfache die IBAN Validierung durchführen:

function checkIBAN($strIBAN)
{

	$swapedIBAN = strtoupper(substr($strIBAN, 4).substr($strIBAN, 0, 4));
	$code = "";	

	for ($i = 0; $i < strlen($swapedIBAN); $i ++)
	{

		$char = $swapedIBAN[$i]; 

		if (is_numeric($char))
		{

			$code .= $char;

		}
		else
		{

			$code .= strval(ord($char) – 55);

		}

	}

	$reminder = "";
	while (true)
	{

		$substr = substr($code, 0, 4);
		$code = substr($code, 4);
		$reminder = intval($reminder.$substr) % 97;

		if (strlen($code) <= 0) break;

	}

	if ($reminder != "1") return false;
	else return true;

} // function checkIBAN($strIBAN)


Bitte genehmigen Sie die Verwendung von Cookies dieser Website! Mehr Informationen

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close