我有這個多維PHP陣列(下面)。像這樣合併或組合一個數組?在PHP
Array
(
[0] => Array
(
[2] => [email protected]
)
[1] => Array
(
[4] => [email protected]
)
[2] => Array
(
[3908] => [email protected]
)
[3] => Array
(
[2548] => [email protected]
)
[4] => Array
(
[3099] => [email protected]
)
[5] => Array
(
[5283] => [email protected]
)
)
我不知道我怎麼會合並嗎?或結合?或者乾脆使用PHP(,下面的)這樣做。
Array
(
[2] => [email protected]
[4] => [email protected]
[3908] => [email protected]
[2548] => [email protected]
[3099] => [email protected]
[5283] => [email protected]
)
幫助
這是不必要地慢,並且是大n^2的O。您可以簡單地連接數組,這將保留鍵和值。 – 2009-07-17 06:04:42
您失去了依賴array_push的密鑰。你必須用$ another替換$ [$ y] = $ z。 – scronide 2009-07-17 06:06:03
謝謝......沒有注意到鑰匙需要完整編輯 – ghostdog74 2009-07-17 06:09:32