Actually i got multidimensional array like following need to format it. Already wasted lots of time figuring out it but no success 
**$main**:

```
Array
(
    [0] => Array
        (
            [id] => 59
            [value] => 3D-English
            [t_id] => 5
        )

    [1] => Array
        (
            [id] => 58
            [value] => 2D-English
            [t_id] => 5
        )

    [2] => Array
        (
            [id] => 58
            [value] => 2D-English
            [t_id] => 3
        )

)

```

---

Want to format into this array , how it could be achieved using php 

```
Array
(
    [0] => Array
        (
            [id] => 59
            [value] => 3D-English
            [t_id] => 5
        )
    [1] => Array
        (
            [id] => 58
            [value] => 2D-English
            [t_id] => 5-3
        )

)

```

**Update: Tried this**

```
$tmp="";
foreach($main as $k =>$v)
{
       if($tmp==$v['id'])
       {
              $tmparr[$v['id']]= $v['id'];

           if($tmparr['value']=="")
           {
               $tmparr['value'] = $v['t_id'];
           }
           else
           {
               $tmparr['value']= $tmparr['value']."-".$v['t_id'];
           }

       }
      else
     {
       $tmp= $v['id'];
     }
}

```