Adding of leading zeros in PHP is really easy using the sprintf function.
Example :
$x = 3; print sprintf("%04d",$x);
which will print '0003'
Here are sprintf's docs : sprintf manual on php.net .
How to add leading zeros to a number in PHP
Adding of leading zeros in PHP is really easy using the sprintf function.
Example :
$x = 3; print sprintf("%04d",$x);
which will print '0003'
Here are sprintf's docs : sprintf manual on php.net .
Rating: (0+, 0-) In: PHP 5