Salve, qualcuno sa dove posso trovare una funzione in PHP per la verifica formale del codice fiscale?
Io ne ho scritta una semplice ma nn va.
La riporto in basso così se c'è qlk errore evidente me lo potete suggerire.
Grazie a tutti.
codice:
function controlla_codf($cod){
$tmp1 = substr($cod, 0, 6);
if (!is_string($tmp1))
return false;
echo"$tmp1
";
$tmp1 = substr($cod, 6, 2);
if (!is_numeric($tmp1))
return false;
$tmp1 = substr($cod, 8,1);
if (!is_string(tmp1))
return false;
$tmp1 = substr($cod, 9, 2);
if (!is_numeric($tmp1))
return false;
$tmp1 = substr($cod, 11, 1);
if (!is_string(tmp1))
return false;
$tmp1 = substr($cod, 12, 3);
if (!is_numeric($tmp1))
return false;
$tmp1 = substr($cod, 15, 1);
if (!is_string($tmp1))
return false;
return true;
}