2011-06-18 24 views
0

我有一个数组寻找这样:如何显示数组的键?

Array 
(
[0] => a 
[1] => b 
[3] => c 
[4] => d 
[15] => e 
) 

,我想这样的事情:

Array 
(
[0] => a 
[1] => b 
[2] => c 
[3] => d 
[4] => e 
) 

如何获得预期的效果?

+1

可能重复的[PHP数组重新填充键](http://stackoverflow.com/questions/4123940/php-array-re-populate-keys)和[其他](http://stackoverflow.com/search?q=php+array+reindex) –

回答

1
$new_array = array_values($old_array); //this will return sorted one