0

我有一个数组如下:

    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 数组替换该内部数组。

4

1 回答 1

1

这应该可以解决问题。

$array[154541] = array("3831211" => $alerts);

或者如果内部数组有更多元素:

$array[154541][3831211] = $newData;
于 2013-07-11T10:22:50.120 回答