我有一个for循环生成的内容(实际列表较长),
Array
(
[0] => Array
(
[0] => apple
[1] => 3
)
[1] => Array
(
[0] => orange
[1] => 1
)
)
如何获得添加了键(名称,数字)的以下内容?
Array
(
[0] => Array
(
[name] => apple
[number] => 3
)
[1] => Array
(
[name] => orange
[number] => 1
)
)
答案 0 :(得分:0)
我从另一篇文章中找到了答案。 change inner key in multidimensional array php
foreach($results as $arr1){
$results3[] = array_combine($keys, $arr1);
}