Reputation: 7094
i have an array in php like:
$a = array(0=>'a', 1=>'b', 2=>'c', 3=>'d');
Now i unset an element in array:
unset($a[2]);
Now i have the array as:
$a = array(0=>'a', 1=>'b', 3=>'d');
But i want to reorder the array such that the indexes are numerically organized, like:
$a = array(0=>'a', 1=>'b', 2=>'d');
What i can do to get this change?
Upvotes: 0
Views: 306
Reputation: 58962
A solution is to merge your array with an empty array, like so:
$a = array_merge(array(), $a);
Upvotes: 1