我需要一种重新排列多维数组的方法。有没有简单的解决方案呢?我之前一直使用array_values来完成单个数组,但它不支持多维数组。带有多维数组的PHP array_values
我的阵列看起来像这样
Array
(
[2] => Array
(
[text] => test
)
[5] => Array
(
[text] => test
)
[8] => Array
(
[text] => test
)
)
我想它是
Array
(
[0] => Array
(
[text] => test
)
[1] => Array
(
[text] => test
)
[2] => Array
(
[text] => test
)
)
如果我理解正确,你想按键排序,对不对?不删除数组键?或者,你是按个别“文本”项目排序? – pp19dd 2012-03-20 20:58:34
可能重复? [你如何在PHP中重新索引数组](http://stackoverflow.com/questions/591094/how-do-you-reindex-an-array-in-php) – mseancole 2012-03-20 21:08:23
可能的重复[Array \ _values from multidimensional array ](http://stackoverflow.com/questions/9694072/array-values-from-multidimensional-array) – azerafati 2017-04-04 11:25:58