I'm tying create a reference generator in PHP, and i need format String.
i tried this code but don't work
function refAll($db, $contest, $ano){
$newkey = getlastid($db)+1;
return sprintf("%s%d%1$05d",$contest, $ano, $newkey);}
the goal is the output sting formatted like this ABC201500000, where ABC2015 is fixed and the 00000 is always the value in $newkey but with 5 digits
in my code
$newkey = 1
$contest = ABC
$ano = 2015
and the output is always ABC201500000
getlastid()since that is what generates the value for$newKeywhich is not working.$05d? Shouldn't that be%05d? $05 means nothing to sprintf