Forum Moderators: coopster
I was wondering if there is a way to format a number to add 1 or 2 '0' before the actual number.
For example, if I have the number '1', I would want it to print it to look like '001' instead of just '1'. Same thing for '12' would look like '012'...
Or do I have to add manually the 0 before?
Thank you,
Example:
$Number = 1;
printf("%03d",$Number);
should yield:
001
%03d explanation:
0 = pad with a zero
3 = fill it up to 3 columns
d = it's an integer
You can tweak that to your needs.
Read more at [php.net...]