@@ 545-552 (lines=8) @@ | ||
542 | // calculate check digit C |
|
543 | $p = 1; |
|
544 | $check = 0; |
|
545 | for ($i = ($len - 1); $i >= 0; --$i) { |
|
546 | $k = array_keys($chars, $code{$i}); |
|
547 | $check += ($k[0] * $p); |
|
548 | ++$p; |
|
549 | if ($p > 20) { |
|
550 | $p = 1; |
|
551 | } |
|
552 | } |
|
553 | $check %= 47; |
|
554 | $c = $chars[$check]; |
|
555 | $code .= $c; |
|
@@ 559-566 (lines=8) @@ | ||
556 | // calculate check digit K |
|
557 | $p = 1; |
|
558 | $check = 0; |
|
559 | for ($i = $len; $i >= 0; --$i) { |
|
560 | $k = array_keys($chars, $code{$i}); |
|
561 | $check += ($k[0] * $p); |
|
562 | ++$p; |
|
563 | if ($p > 15) { |
|
564 | $p = 1; |
|
565 | } |
|
566 | } |
|
567 | $check %= 47; |
|
568 | $k = $chars[$check]; |
|
569 | return $c.$k; |