我有一个数组如下:
Array
(
[154541] => Array
(
**[3831211] => Array
(
[34443] => 34443
[34444] => 34444
[34438] => 34438
[34442] => 34442
[34450] => 34450
)**
)
[154514] => Array
(
**[3830597] => Array
(
[34442] => 34442
[34450] => 34450
[34443] => 34443
[34444] => 34444
[34438] => 34438
)**
)
[154477] => Array
(
**[3829564] => Array
(
[34442] => 34442
[34444] => 34444
[34438] => 34438
[34450] => 34450
[34443] => 34443
)**
[3830046] => Array
(
[34442] => 34442
[34444] => 34444
[34443] => 34443
[34438] => 34438
[34450] => 34450
)
)
[154474] => Array
(
[3829402] => Array
(
[34442] => 34442
[34450] => 34450
[34443] => 34443
[34438] => 34438
[34444] => 34444
)
)
[154472] => Array
(
[3831553] => Array
(
[34443] => 34443
[34450] => 34450
[34438] => 34438
[34444] => 34444
[34442] => 34442
)
[3829803] => Array
(
[34443] => 34443
[34444] => 34444
[34450] => 34450
[34442] => 34442
[34438] => 34438
)
[3829802] => Array
(
[34443] => 34443
[34444] => 34444
[34438] => 34438
[34450] => 34450
[34442] => 34442
)
[3831552] => Array
(
[34444] => 34444
[34450] => 34450
[34443] => 34443
[34442] => 34442
[34438] => 34438
)
[3830078] => Array
(
[34444] => 34444
[34442] => 34442
[34443] => 34443
[34438] => 34438
[34450] => 34450
)
)
)
现在我想用我新生成的名为$ alerts的数组替换内部数组(我在上面的数组中将内部数组设为**)。
我没有得到如何用$ alerts数组替换内部数组。
答案 0 :(得分:1)
这应该可以解决问题。
$array[154541] = array("3831211" => $alerts);
或者如果内部数组有更多元素:
$array[154541][3831211] = $newData;