<?php 
include "qrlib.php";

// due_amnt
// cnsvrefcode
function left($str, $length) {
     return substr($str, 0, $length);
}
 
function right($str, $length) {
     return substr($str, -$length);
}

$pre_digit1 = right($_REQUEST['cnsvrefcode'],2);
$num_digit1 = right($pre_digit1,1)+left($pre_digit1,1);
$digit1 = right($num_digit1,1);

QRcode::png('|044555500035501'.PHP_EOL.$digit1.$_REQUEST['cnsvrefcode'].PHP_EOL.'346200003800'.PHP_EOL.intval($_REQUEST['due_amnt']).'00',false,'L',4);
// '%7C1231233%0A564654%0A1231%0A011'
?>