function BARCODE::_postEncode in Barcode 6
1 call to BARCODE::_postEncode()
File
- ./
barcode.inc.php, line 868
Class
Code
function _postEncode($barnumber) {
$encTable = array(
"11000",
"00011",
"00101",
"00110",
"01001",
"01010",
"01100",
"10001",
"10010",
"10100",
);
$sum = 0;
$encstr = "";
for ($i = 0; $i < strlen($barnumber); $i++) {
$sum += (int) $barnumber[$i];
$encstr .= $encTable[(int) $barnumber[$i]];
}
if ($sum % 10 != 0) {
$check = (int) (10 - $sum % 10);
}
$encstr .= $encTable[$check];
$encstr = "1" . $encstr . "1";
return $encstr;
}