Comprueba que tus billetes sean válidos
function Euro($string)
{
settype($string, 'string');
if (strlen($string) != 12) {
return false;
}
$string = str_replace(
array('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'),
array(2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9),
strtoupper($string)
);
$stack = 0;
for ($i = 0; $i < 12; $i++) {
$stack += $string[$i];
}
if ($stack % 9 == 0) {
return true;
}
return false;
}
if (isset($_REQUEST["codigo"])) {
if (Euro($_REQUEST["codigo"])) echo $_REQUEST["codigo"]. " es un billete válido";
elseecho $_REQUEST["codigo"]. " es un billete FALSO";
}
Código : alixaxel / aNieto2k