我有一些問題重新排列在PHP中的數組。這是我...PHP Array重新排列
Array
(
[N] => Array
(
[68] => sssssss ttttttt
[69] => uuuuuu vvvvvvvv
)
[D] => Array
(
[05] => zzzzzzzz zzzzzzzz
[07] => tttttttttttt ttttttttttt
)
[P] => Array
(
[88] => yyyyyyy zzzzzzzz
)
[C] => Array
(
[04] => wwwwww wwwwwww
[06] => iiiiiii iiiiiiii
[41] => zzzzzzzzzz zzzzzzzzzz
)
)
我要的是下面...
Array
(
[N] => Array
(
[68] => sssssss ttttttt
[69] => uuuuuu vvvvvvvv
// only C are added here with N
[04] => wwwwww wwwwwww
[06] => iiiiiii iiiiiiii
[41] => zzzzzzzzzz zzzzzzzzzz
)
[D] => Array
(
[05] => zzzzzzzz zzzzzzzz
[07] => tttttttttttt ttttttttttt
)
[P] => Array
(
[88] => yyyyyyy zzzzzzzz
)
[C] => Array
(
[04] => wwwwww wwwwwww
[06] => iiiiiii iiiiiiii
[41] => zzzzzzzzzz zzzzzzzzzz
)
)
我需要的C-元素被添加到N,而所有其餘的保持原樣包括C本身。
我該如何做到這一點?
有人幫助,請... 感謝
這不是真的問題,但它輸出的只是第一個數組加在一起N + C ...但不能循環通過它...任何方式,我從你的代碼學到一些東西。 ..謝謝。 –
@MrInternet恐怕我沒有按照; 'print_r($ arr)'應該給出你想要的東西,可以看到[這裏](http://codepad.viper-7.com/HfZvhb)。 –
沒有,print_r只給出$ arr ['N'] + = $ arr ['C'];但其他人呢?像['D'] ['P']?他們不包括在內。 –