Merging multidimensional array in php
<p>I try to merge multidimensional arrays to one. I was using <code>array_merge</code> function but it does not work. </p>

<p>Look bellow at the arrays</p>

<pre><code>$arr1 = [['title' =&gt; 'first title', 'phone' =&gt; '9923490', 'address' =&gt; 'thes 38'], ['title' =&gt; 'second title', 'phone' =&gt; '42342', 'address' =&gt; '2th thes 38 aradippou']];
$arr2 = [['town' =&gt; 'london'], ['town' =&gt; 'manchester']];


Array
(
    [0] =&gt; Array
        (
            [title] =&gt; first title
            [phone] =&gt; 9923490
            [address] =&gt; thes 38 aradippou
        )

    [1] =&gt; Array
        (
            [title] =&gt; second title
            [phone] =&gt; 42342
            [address] =&gt; 2th thes 38 aradippou
        )

)
Array
(
    [0] =&gt; Array
        (
            [town] =&gt; london
        )

    [1] =&gt; Array
        (
            [town] =&gt; manchester
        )

)
</code></pre>

<p>I want to add the town fields to the $arr1 so it looks like as below array:</p>

<pre><code>Array
(
    [0] =&gt; Array
        (
            [title] =&gt; first title
            [phone] =&gt; 9923490
            [address] =&gt; thes 38 aradippou
            [town] =&gt; london
        )

    [1] =&gt; Array
        (
            [title] =&gt; second title
            [phone] =&gt; 42342
            [address] =&gt; 2th thes 38 aradippou
            [town] =&gt; manchester
        )

)
</code></pre>

<p>I've try the <code>array_merge</code> function but the result is like thus:</p>

<pre><code>Array
(
    [0] =&gt; Array
        (
            [title] =&gt; first title
            [phone] =&gt; 9923490
            [address] =&gt; thes 38 aradippou
        )

    [1] =&gt; Array
        (
            [title] =&gt; second title
            [phone] =&gt; 42342
            [address] =&gt; 2th thes 38 aradippou
        )

    [2] =&gt; Array
        (
            [town] =&gt; london
        )

    [3] =&gt; Array
        (
            [town] =&gt; manchester
        )

)
</code></pre>