我在PHP中像這樣的數組:array_slice在多維數組中?
Array
(
[0] => Array
(
[915] => 1
[1295] => 1
[1090] => 1
[1315] => 0.93759357774
[128] => 0.93759357774
[88] => 0.731522789561
[1297] => 0.731522789561
[1269] => 0.525492880722
[1298] => 0.525492880722
[121] => 0.519133966069
)
[1] => Array
(
[585] => 1
[1145] => 1
[1209] => 1
[375] => 1
[1144] => 1
[913] => 1
[1130] => 0.996351158355
[215] => 0.937096401456
[1296] => 0.879373313559
[30] => 0.866473953643
[780] => 0.866473953643
[1305] => 0.866473953643
[1293] => 0.866473953643
)
)
如何獲得子陣列的第1,第5行對於每個陣列,像這樣:
結果:
Array
(
[0] => Array
(
[915] => 1
[1295] => 1
[1090] => 1
[1315] => 0.93759357774
[128] => 0.93759357774
)
[1] => Array
(
[585] => 1
[1145] => 1
[1209] => 1
[375] => 1
[1144] => 1
)
)
哇,它解決了我的問題。謝謝! – Apocalypshiit 2010-10-01 07:45:50
沒問題!很高興幫助 – 2010-10-01 07:47:39
不應該是'$ sliced_array [] = array_slice($ sub_array,0,5);'? – SAVAFA 2013-05-22 18:03:05