PHP remove non-existing indexes from array and rearrange [duplicate]
Possible Duplicate:
php array re populate keys
is there a way to remove all the non-existing indexes from a php array and then rearrange it? For example
Array
(
[0] => a
[2] => b
[3] => c
[6] => d
)
TO
Array
(
[0] => a
[开发者_Go百科1] => b
[2] => c
[3] => d
)
Big thanks! Rik.
Just use this built-in function
$array=array_values($array)
Use array_values.
$arr = array_values($arr);
精彩评论