This function will take an array and give you back an array with all the same values but re-indexed numerically, starting at zero. Think of it somewhat as straightening a deck of cards. All the cards are still there but now they’re all presented in a nice, neat stack.

The keys of your input array will not be used. Any nested arrays will not be re-indexed, however. Those keys will remain.

The array you pass to this function will not be altered. A new array is created and returned to you.

$arr = array('elephant',
             'a' => 'apple',
             'b' => 'banana',
             'c' => 'carrot',
             'fly',
             array('z' => 'zucchini',
                   'y' => 'yarrow',
                   'platypus'),
             'gnat');
$new_arr = array_values($arr);
/*
array (
  0 => 'elephant',
  1 => 'apple',
  2 => 'banana',
  3 => 'carrot',
  4 => 'fly',
  5 => array (
         'z' => 'zucchini',
         'y' => 'yarrow',
          0  => 'platypus',
       ),
  6 => 'gnat'
)
*/