-1

Possible Duplicate:
How to re-index the values of an array in PHP?

I'm using several php functions to carry certain data over through an array, and through the process I get arrays that print_r like the following:

Array ([0] => 35 [4] => 36 [6] => 34)

What do I have to do if I want to reorder it back to the following? (I use a for statement and need the keys to be in consecutive order starting from 0 again)

Array ([0] => 35 [1] => 36 [2] => 34)
Community
  • 1
  • 1
Simon Suh
  • 10,599
  • 25
  • 86
  • 110

1 Answers1

4
$array = array_values($array);
Dan Grossman
  • 51,866
  • 10
  • 112
  • 101