How to merge array values on the basis of repetive values?
<p>I have this array in my code</p>

<pre><code>Array
(
[0] =&gt; Array
    (
        [0] =&gt; Roof setting
        [1] =&gt; [2013-04-22,7]
    )

[1] =&gt; Array
    (
        [0] =&gt; Garbage Collection
        [1] =&gt; [2013-04-22,22]
    )

[2] =&gt; Array
    (
        [0] =&gt; Sales Payout
        [1] =&gt; [2013-04-22,10]
    )

[3] =&gt; Array
    (
        [0] =&gt; Sales Payout
        [1] =&gt; [2013-04-25,10]
    )

[4] =&gt; Array
    (
        [0] =&gt; Sales Payout
        [1] =&gt; [2013-04-25,10]
    )

[5] =&gt; Array
    (
        [0] =&gt; Fix cable car2
        [1] =&gt; [2013-04-24,77.79]
    )

[6] =&gt; Array
    (
        [0] =&gt; Fix cable car2
        [1] =&gt; [2013-04-25,77.79]
    )

)
</code></pre>

<p>Now I want to get this array in the form that for each repeating label it shows the label only one time and repetive dates along those labels multiple times.The result should look like this</p>

<pre><code>Array
(
    'label': =&gt; Roof setting
        (

        'data:' =&gt; [2013-04-22,7]
    ),

   'label' =&gt; Garbage Collection
    (

        'data': =&gt; [2013-04-22,22]
    )

'label' =&gt; Sales Payout
    (

       'data:' =&gt; [[2013-04-22,10],[2013-04-25,10],[2013-04-25,10]]
    )



   'label' =&gt;Fix cable car2
    (
       'data' =&gt; [[2013-04-24,77.79[,2013-04-25,77.79]]
        [1] =&gt; [2013-04-24,77.79[
    )
)
</code></pre>
