/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function rutValido( $rut ){ return false; } $sCodigoVerificador = $aMatch[2]; $iCont = 2; $iSuma = 0; if ($iCont>7) { $iCont = 2; } $iSuma+= ($sRutBase{$i}) *$iCont; $iCont++; } $iDigito = 11-($iSuma%11); return ($sCaracter == $sCodigoVerificador); } echo rutValido('12159116-2') ? 1 : 0; #Out 1 echo rutValido('54545454545') ? 1 : 0; #Out 0