A function to combine two arrays?
<p>How to get array c from a and b ?</p>

<pre><code>$arr_a = array(
    'foo' =&gt; array(
        'bar' =&gt; 1,
        'baz' =&gt; 2,
    ),
    'lorem' =&gt; array(
        'ipsum' =&gt; array(
            'dolor' =&gt; 'sit',
        ),
    ),  
    'mollis' =&gt; 'ultrices',
);
</code></pre>

<p>and the second array look like this:</p>

<pre><code>$arr_b = array(
    'foo' =&gt; array(
        'ante' =&gt; 'urna'
    ),
    'lorem' =&gt; array(
        'ipsum' =&gt; array(
            'dolor' =&gt; 'turpis'
        ),
    ),
);
</code></pre>

<p>The result array should be:</p>

<pre><code>$arr_c = array(
    'foo' =&gt; array(
        'bar' =&gt; 1,
        'baz' =&gt; 2,
        'ante' =&gt; 'urna',
    ),
    'lorem' =&gt; array(
        'ipsum' =&gt; array(
            'dolor' =&gt; 'turpis', 
        ),
    ),
    'mollis' =&gt; 'ultrices',  
);
</code></pre>

<p>I''ve tried <code>array_merge</code> but can't get a desirable result....
Cheers</p>

<pre><code>$arr_c = array_merge_recursive($arr_a, $arr_b);
</code></pre>

<p>gives me an unwanted array - it's a bit tricky here:</p>

<pre><code>Array
(
    [foo] =&gt; Array
        (
            [bar] =&gt; 1
            [baz] =&gt; 2
            [ante] =&gt; urna
        )

    [lorem] =&gt; Array
        (
            [ipsum] =&gt; Array
                (
                    [dolor] =&gt; Array
                        (
                            [0] =&gt; sit // unwanted :(
                            [1] =&gt; turpis
                        )

                )

        )

    [mollis] =&gt; ultrices
)
</code></pre>
