0

I am trying to get the value between 001 to 012 with range function but it's returning 1,2,3....12 range(001,012) but i want value like this 001,002,003,,,012

S_Cube_R
  • 31
  • 1
  • 4
  • 6
    Does this answer your question? [Zero-pad digits in string](https://stackoverflow.com/questions/324358/zero-pad-digits-in-string) – Hendrik Jan 14 '22 at 12:38

1 Answers1

0

Need to loop through and append them:

foreach (range(1, 12) as $number){
  $numbers[] = sprintf("%03d", $number);
}

print_r($numbers);
Wakka
  • 426
  • 1
  • 9