2011-06-18 31 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