0

I am not sure if these are the correct words to express my query. I have the following array, result of filtration stage. As you can see the keys are not consecutive [e.g. 2,3,5,7 etc]. is there any php function that will automatically re-structure the keys for me (like, the first key is 0 and then consecutive 1,2,3 etc.)? sort() function does not help and I also tried several other PHP array sorting functions but none helped.

Array
(
    [2] => RP/
    [3] => LONU1
    [5] => 1.ISL
    [7] => 2.KHO
    [9] => 3.KHO
    [11] => 4.RUMA/
    [12] => 5  EK
    [13] => 6  EK 582
    [14] => 7  E
    [15] => 8  EK 011 L
)
newbie
  • 27
  • 6

1 Answers1

2

array_values is your friend.

$array = array_values($array);

Source

Community
  • 1
  • 1
David
  • 3,831
  • 2
  • 28
  • 38