Here is my code:
<?php
$variable1 = 00001;
$variable2 = (sprintf('%04d', $variable1 + 1));
echo $variable2;
?>
How come the outcome of this code is "0002" and not "00002"? in other words it is missing a 0.
The 4 in %04d sets the total width of the printed value