-1

Generate number like auto icrement with zero I wont generate ordinal number example from 0 to 999 but just 3 digit, from 3 digits zero like this

000
001
002
003
...
999

how create this with php?

Angel's Wing's
  • 105
  • 1
  • 1
  • 10

1 Answers1

2

Use str_pad and a for-loop:

    for($i=0; $i<=999;$i++) {
        echo str_pad($i, 3, '0', STR_PAD_LEFT);
    }
jossiwolf
  • 1,865
  • 14
  • 22