我有一个数组:
Array
(
[0] => ololo
[2] => test
[3] => haha
[7] => nice
)
如何将数组的索引更改为:
Array
(
[0] => ololo
[1] => test
[2] => haha
[3] => nice
)
最佳答案
来自 PHP.net:
array_values() returns all the values from the input array and indexes the array numerically.
$arr = array_values($arr);
关于php - 如何使用非连续数字键重新键入数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6377630/