Leading zeros in PHP
This is how you add a certain number of leading zeros to integers in PHP.
$x = 1;
$y = sprintf("%03d",$x);
echo $y;
$y = sprintf("%03d",$x);
echo $y;
The 3 in "%03d" is the amount of digits you have in the end. So %02d if you only want 2 digits.
Source: Romeo, http://www.webmasterworld.com/forum88/4273.htm


