PHP for loop

Hi!

I’m trying to create a list of numbers like below (only seven digits), but I wasn’t able to create the logic. Can you help me?

0000001
0000002
0000003
.
.
.
.

Ah, OK. I think just figured it out, I’ll edit my question with a solution soon.

foreach(range(0,10) as $n) {
 echo str_pad($n,7,"0",STR_PAD_LEFT).PHP_EOL;
}
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.