cañangasñangas Posted May 7, 2012 Report Share Posted May 7, 2012 (edited) codigo: <?php function getRut($rut){ $rut = strrev($rut); $aux = 1; for($i=0;$i<strlen($rut);$i++){ $aux++; $s += intval($rut[$i])*$aux; if($aux == 7){ $aux=1; } } $digit = 11-$s%11; if($digit == 11){$d = 0;}elseif($digit == 10){$d = "K";}else{$d = $digit;} return $d; } ?> lo unico que hace falta es llamar a la funcion con un rut como parametro ejemplo getRut(17594215) y getRut te entregara el digito verificador del rut 17594215 Edited May 7, 2012 by cañangasñangas Link to comment Share on other sites More sharing options...
DemianBelial Posted July 10, 2012 Report Share Posted July 10, 2012 wena... cortito y sencillo... grax por el aporte!!! Link to comment Share on other sites More sharing options...
AttAqUE Posted July 17, 2012 Report Share Posted July 17, 2012 Buen aporte! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now