-1

How do I start the array of a range at 1 instead of 0, Code looks like this:

    $numbers = range(0, 14);

I tried this but that does not solve my problem

    $numbers = range(0, 14);
Deepak Acharya
  • 93
  • 1
  • 1
  • 16
Tina Turner
  • 93
  • 1
  • 2
  • 4

3 Answers3

5

You can also go for :

$numbers = range(0, 14);

array_unshift($numbers,"");
unset($numbers[0]);
Happy Coding
  • 2,517
  • 1
  • 13
  • 24
2

You could try this:

$numbers = array_combine(range(1,14), range(1,14));
tino.codes
  • 1,512
  • 1
  • 12
  • 23
1

Try this code These will help you

$data = array_slice(range(0,12), 1, null, true);
Deepak Acharya
  • 93
  • 1
  • 1
  • 16