PHP - Merge two arrays on same key
<p>I'd like to merge two arrays on same key.</p>

<p>Here's the 1st array :</p>

<pre><code>Array
(
[2052] =&gt; Array
    (
        [495] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 79755
                    )

                [1] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 79755
                    )
            )

    )

[4566] =&gt; Array
    (
        [488] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 231610
                    )

                [1] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 231610
                    )
            )

    )
)
</code></pre>

<p>And this is the 2nd array</p>

<pre><code>Array
(
[2052] =&gt; Array
    (
        [495] =&gt; Array
            (
                [TOTAL_RI] =&gt; 1000000
                [TOTAL_ANGGARAN] =&gt; 500000
            )

    )

[4566] =&gt; Array
    (
        [488] =&gt; Array
            (
                [TOTAL_RI] =&gt; 2000000
                [TOTAL_ANGGARAN] =&gt; 1000000
            )

    )
)
</code></pre>

<p>And i'd like merge that two arrays to be like this :</p>

<pre><code>Array
(
[2052] =&gt; Array
    (
        [495] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 79755
                    )

                [1] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 79755
                    )

                [TOTAL_RI] =&gt; 1000000
                [TOTAL_ANGGARAN] =&gt; 500000
            )

    )

[4566] =&gt; Array
    (
        [488] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 231610
                    )

                [1] =&gt; Array
                    (
                        [ID_RI_BELANJA] =&gt; 231610
                    )

                [TOTAL_RI] =&gt; 2000000
                [TOTAL_ANGGARAN] =&gt; 1000000
            )

    )
)
</code></pre>

<p>This is my first project and I don't know what to do.</p>

<p>Can anyone tell me how to do that?</p>

<p>Pls</p>