I'm trying to make a for loop with numbers given by user ($start and $limit), but I want to be able to write '0001' as $start
and '1000' as $limit
and print each one of numbers. The problem is, only the first number is printed as '000..' and after increment, those zeros disappear. This is my code:
$start = 0001;
$limit = 1000;
for ($i=$start; $i <= $limit; $i++) {
echo $i.'<br>';
}
outputs:
001
2
3
...
1000
Is there any way to make it as:
0001
0002
...
1000