note 79981 added to function.bcmod
| From: | mcuelenaere at gmail dot com | Date: | Fri, 21 Dec 2007 21:00:54 +0000 |
| Subject: | note 79981 added to function.bcmod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-133873@lists.php.net to get a copy of this message | ||
Heres an useful IBAN generate function:
<?php
function controleer_iban($iban) {
$iban = str_replace(array(" ", " ", " ", "\t"),
"", $iban);
$iban = strtoupper(str_replace(" ", "", $iban));
if(strlen($iban)>34)
return false;
$acceptabel = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9 0";
$acceptabel = explode(" ", $acceptabel);
for($i = 0; $i<strlen($iban); $i++) {
if(in_array(substr($iban, $i, 1), $acceptabel) === false)
return false;
}
$alfa = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
$alfa = explode(" ", $alfa);
for($i = 1; $i<27; $i++) {
$alfa_replace[] = $i+9;
}
$controlegetal = str_replace($alfa, $alfa_replace, substr($iban, 4, strlen($iban)-4).substr($iban,
0, 2)."00");
$controlegetal = 98 - (int)bcmod($controlegetal,97);
if((int)$controlegetal === (int)substr($iban, 2, 2))
return true;
else
return false;
}
?>
----
Server IP: 193.190.198.20
Probable Submitter: 84.197.222.143
----
Manual Page -- http://www.php.net/manual/en/function.bcmod.php
Edit -- https://master.php.net/note/edit/79981
Del: integrated -- https://master.php.net/note/delete/79981/integrated
Del: useless -- https://master.php.net/note/delete/79981/useless
Del: bad code -- https://master.php.net/note/delete/79981/bad+code
Del: spam -- https://master.php.net/note/delete/79981/spam
Del: non-english -- https://master.php.net/note/delete/79981/non-english
Del: in docs -- https://master.php.net/note/delete/79981/in+docs
Del: other reasons-- https://master.php.net/note/delete/79981
Reject -- https://master.php.net/note/reject/79981
Search -- https://master.php.net/manage/user-notes.php