How to increment through LONG number in PHP, for example counter starts from 0000000001 and ends 0000000010, how to loop through in a for loop retaining the zero's. I do not want to pad 0's in front of the number, because I can increase the number limit to 9999999999999.
for ($i=0000000001; $i<=0000000010; $i++) {
echo $i;
}
Output: 0000000001 0000000002 0000000003 0000000004 0000000005 0000000006 0000000007 0000000008 0000000009 0000000010
Can someone please help me.
You can use str_pad:
str_pad($value, 8, '0', STR_PAD_LEFT);
OR if it's just for output:
sprintf('%08d', 1234567);
OR
echo str_pad($value, 8, '0', STR_PAD_LEFT);
EDIT
for ($i=1; $i<=10; $i++) {
echo str_pad($i, 10, '0', STR_PAD_LEFT);
}