Last active
April 11, 2019 14:44
-
-
Save zrkb/747866c47f47762989caf0fa7707160b to your computer and use it in GitHub Desktop.
Revisions
-
zrkb revised this gist
Apr 11, 2019 . No changes.There are no files selected for viewing
-
zrkb revised this gist
Apr 11, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ <?php function digito_verificador($ci, $baseMax = 11) { $resultado = 0; -
zrkb created this gist
Oct 12, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ function digito_verificador($ci, $baseMax = 11) { $resultado = 0; $index = 0; for ($rucIndex = strlen($ci) - 1; $rucIndex >= 0; $rucIndex--) { $resultado += (int) $ci[$rucIndex] * ($index + 2); $r = $resultado % $baseMax; $index++; }; $verificador = $r > 1 ? $baseMax - $r : 0; return $verificador; }