Forum Moderators: coopster
but beware you might need a switch [php.net] in order to figure if the digits are single (1,2,3 etc....)
or (10, 11, 12 etc...) or (100, 101 etc..)
and add the appropriate number of zero.
<edit>
forgot: the above will also call for a loop, since you need figuring how many numbers will be changed.
hmmm, it sounds too complicated, any other alternative?
</edit>
If you want to respect the number of zero in front of each number
you could preg_replace() by adding those zeros.
Or str_pad() [uk.php.net] which can do just that. Or even sprintf as eelixduppy suggests. sprintf is more concise.
eg.
$num = 2;
echo str_pad($num,7,'0',STR_PAD_LEFT);
echo '=';
echo sprintf('%07u',$num);
Note that 0000002 is essentially a string, not a number. You count like 1 2 3 4, but display it as '0000001' '0000002' '0000003' '0000004'.