Combining Fields in an array based upon value
<p>So, I have looked at several posts regarding array_merge and array_unique, but haven't seen anything exactly like what I'm trying to do.  I'm assuming the solution would be something like this: <a href="http://stackoverflow.com/questions/4748292/php-merge-down-multidimensional-arrays-by-named-key?rq=1">PHP - Merge-down multidimensional arrays by named key</a>, except that I'm using strings and I'm also going to wind up with duplicate keys which I assume is not going to work.</p>

<p>I have an array ($classagg) that I'm using to create a webpage detailing classes for an event.  The code I'm currently using is:</p>

<pre><code>usort($classagg, function($a, $b) {
 return strcmp($a['title'], $b['title']);
});

foreach($classagg as $out){
print "
&lt;p&gt;
&lt;a class=\"education-class-list-title\" name=\"$out[presenter]\"&gt;$out[title]&lt;/a&gt;&lt;br /&gt;
&lt;span class=\"education-class-list-description\"&gt;$out[description]&lt;/span&gt;&lt;br /&gt;
&lt;span class=\"education-class-list-presenter\"&gt; Presented by: &lt;a           href=\"/event/$out[eventType]/$out[eid]?qt-event=3#$out[presenter]\"&gt;$out[presenter]&lt;/a&gt;        &lt;/span&gt;
&lt;/p&gt;
";
}
</code></pre>

<p>Everything is working well, however I have some classes where two presenters are presenting the same class.  The system is setup as a CRM, so unfortunately I can't have a combined application for both presenters.</p>

<p>A simplified version of the current array might like:</p>

<pre><code>Array
(
    [0] =&gt; Array
        (
            [title] =&gt; Class 1
            [description] =&gt; This is a Class
            [presenter] =&gt; John
        )

    [1] =&gt; Array
        (
            [title] =&gt; Class 2
            [description] =&gt; This is a another class
            [presenter] =&gt; Sue
        )

    [2] =&gt; Array
        (
            [title] =&gt; Class 1
            [description] =&gt; Sally is presenting with John
            [presenter] =&gt; Sally
        )


)
</code></pre>

<p>I want to merge arrays 0 and 2, keeping the title, keeping one of the descriptions (preferably the longer one), and keep both of the names.</p>

<p>I greatly appreciate any help.</p>
