Skip to content

Commit

Permalink
util modulo11
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardokum committed Aug 14, 2019
1 parent 439831f commit 2878201
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,8 @@ public static function fatorVencimentoBack($factor, $format = 'Y-m-d')
public static function modulo11($n, $factor = 2, $base = 9, $x10 = 0, $resto10 = 0)
{
$sum = 0;
$n = (int) $n;
for ($i = mb_strlen($n); $i > 0; $i--) {
$sum += mb_substr($n, $i - 1, 1)*$factor;
$sum += ((int) mb_substr($n, $i - 1, 1))*$factor;
if ($factor == $base) {
$factor = 1;
}
Expand Down

0 comments on commit 2878201

Please sign in to comment.