I have a variabling number that sometimes i below 10 and sometimes more than 10.
How do I echo it so it will always be written as 2 digits. 01 02 03 ... 08 09 10 11 12 and so on. ?
$i = 2; echo sprintf('%02s', $i);
or,
$i = 3; echo str_pad($i, 2, "0", STR_PAD_LEFT);