0

I have an array called $Compare, I used the print_r() function in php:

Array ([2] => Broccoli, raw [3] => Candies, butterscotch [4] => Celery, raw [10] => Apricots, raw)

I want it the keys to be in the correct order: 0,1,2,3 not 2,3,4,10!

In the end it should look like this:

Array ([0] => Broccoli, raw [1] => Candies, butterscotch [2] => Celery, raw [3] => Apricots, raw)
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87
Alex M.
  • 351
  • 2
  • 5
  • 12

1 Answers1

2

Use array_values:

$Compare = array_values($Compare);
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87