PHP reindex array?

MrWhddite333 picture MrWhddite333 · Sep 26, 2011 · Viewed 111k times · Source

I have array that i had to unset some indexes so now it looks like

$myarray [0] a->1
         [1] a-7 b->3
         [3] a-8 b->6
         [4] a-3 b->2

as you can see [2] is missing all i need to do is reset indexes so they show [0]-[3].

Answer

Alex Turpin picture Alex Turpin · Sep 26, 2011

Use array_values.

$myarray = array_values($myarray);