 <p>This may help you</p> <pre><code> [akshay@localhost tmp]$ cat test.php &lt;?php $array= array( (object)array("exercise_name" =&gt; "Hang Clean","category_name" =&gt; "Heavy,Pull,Core"), (object)array("exercise_name" =&gt; "Ice Skaters","category_name" =&gt; "Ground,Lower,Plyometrics"), (object)array("exercise_name" =&gt; "Ice Skaters","category_name" =&gt; "Basketball,Sport Specific") ); function simple_merge($array) { foreach($array as $k) { if(isset($output[$k-&gt;exercise_name])) { array_push($output[$k-&gt;exercise_name]-&gt;multiple_category_name,$k-&gt;category_name); }else { $k-&gt;multiple_category_name = array($k-&gt;category_name); unset($k-&gt;category_name); $output[$k-&gt;exercise_name] = $k; } } return array_values($output); } // Input print_r($array); // Output print_r(simple_merge($array)); ?&gt; </code></pre> <p><strong><em>Output</em></strong></p> <pre><code> [akshay@localhost tmp]$ php test.php Array ( [0] =&gt; stdClass Object ( [exercise_name] =&gt; Hang Clean [category_name] =&gt; Heavy,Pull,Core ) [1] =&gt; stdClass Object ( [exercise_name] =&gt; Ice Skaters [category_name] =&gt; Ground,Lower,Plyometrics ) [2] =&gt; stdClass Object ( [exercise_name] =&gt; Ice Skaters [category_name] =&gt; Basketball,Sport Specific ) ) Array ( [0] =&gt; stdClass Object ( [exercise_name] =&gt; Hang Clean [multiple_category_name] =&gt; Array ( [0] =&gt; Heavy,Pull,Core ) ) [1] =&gt; stdClass Object ( [exercise_name] =&gt; Ice Skaters [multiple_category_name] =&gt; Array ( [0] =&gt; Ground,Lower,Plyometrics [1] =&gt; Basketball,Sport Specific ) ) ) </code></pre>