Reputation: 1039
In php, when I increment:
$numb = "00001";
$numb = $numb +1;
The result is 2.
How do I keep the zeroes and having 00002
?
Useful link for BASH and for JAVA but not able to think of a php version.
Thank you!
Upvotes: 1
Views: 142
Reputation: 23958
Try this:
$numb = "00001";
$numb = $numb +1;
echo str_pad($numb, 5, '0', STR_PAD_LEFT);
Upvotes: 3