Código PHP:
function ObtenerVerhoeff($Cifra)
{ $Mul=array(
array(0,1,2,3,4,5,6,7,8,9),
array(1,2,3,4,0,6,7,8,9,5),
array(2,3,4,0,1,7,8,9,5,6),
array(3,4,0,1,2,8,9,5,6,7),
array(4,0,1,2,3,9,5,6,7,8),
array(5,9,8,7,6,0,4,3,2,1),
array(6,5,9,8,7,1,0,4,3,2),
array(7,6,5,9,8,2,1,0,4,3),
array(8,7,6,5,9,3,2,1,0,4),
array(9,8,7,6,5,4,3,2,1,0));
$Per=array(
array(0,1,2,3,4,5,6,7,8,9),
array(1,2,3,4,0,6,7,8,9,5),
array(2,3,4,0,1,7,8,9,5,6),
array(3,4,0,1,2,8,9,5,6,7),
array(4,0,1,2,3,9,5,6,7,8),
array(5,9,8,7,6,0,4,3,2,1),
array(6,5,9,8,7,1,0,4,3,2),
array(7,6,5,9,8,2,1,0,4,3),
array(8,7,6,5,9,3,2,1,0,4),
array(9,8,7,6,5,4,3,2,1,0));
$inv = array(0,4,3,2,1,5,6,7,8,9);
$Check = 0;
$NumeroInvertido = InvierteNumero($Cifra) ;
for($i=0;$i<strlen($NumeroInvertido)-1;$i++)
{
$Check=$Mul[$Check,bcmod($Per[(($i+1))],8),(int)($NumeroInvertido[$i])] ; // esta line me da error! :(
}
return $Check;
}