這裏的原始數組:如何標頭添加到其他的PHP陣列
Array
(
[0] => Array
(
[0] => ID
[1] => NAME
[2] => GROUP
)
[1] => Array
(
[0] => 1221
[1] => 500
[2] => 2
)
[2] => Array
(
[0] => 1654
[1] => 33
[2] => 23
)
)
隱蔽它來:
Array
(
[0] => Array
(
[ID] => 1221
[NAME] => 500
[GROUP] => 2
)
[1] => Array
(
[ID] => 1654
[NAME] => 33
[GROUP] => 23
)
)
當然還有超過3個頁眉和多於2個陣列的數據。有沒有一種自動的方法可以高效而乾淨地完成這項工作?
'array_combine()'這樣做,但是你需要遍歷數組併爲每個元素調用它。 – Matthew