You are here

function pBarcode39::checksum in Visitors 7

Same name and namespace in other branches
  1. 7.2 pChart/class/pBarcode39.class.php \pBarcode39::checksum()
1 call to pBarcode39::checksum()
pBarcode39::encode39 in pChart/class/pBarcode39.class.php

File

pChart/class/pBarcode39.class.php, line 184

Class

pBarcode39

Code

function checksum($string) {
  $checksum = 0;
  $length = strlen($string);
  $charset = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%';
  for ($i = 0; $i < $length; ++$i) {
    $checksum += strpos($charset, $string[$i]);
  }
  return substr($charset, $checksum % 43, 1);
}