I'm trying to delete an element of an array and then reset the keys.
If I do this:
$colors = array('red','blue','green','yellow','purple','gold','silver');
$colors_key = 0; //It won't always be 0, it could be 3 or 4, etc.
foreach($colors as $key => $value) {
unset($colors [$colors_key]);
}
$new_array = array_values($colors);
And then print out the array, I'll get this:
Array ([1] => blue [2] => green [3] =>yellow [4] =>purple [5] => gold [6]=>silver);
What I would like to get is this:
Array ([0] => blue [1] => green [2] =>yellow [3] =>purple [4] => gold [5]=>silver);
Anyone know how I can do this?