title: Group duplicate array keys in a multidimensional array into subarray
body: <p>I have a multidimensional array called <code>$songs</code>, which outputs the following:</p>
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [Michael Jackson] =&gt; Thriller
          )
  
      [1] =&gt; Array
          (
              [Michael Jackson] =&gt; Rock With You
          )
  
      [2] =&gt; Array
          (
              [Teddy Pendergrass] =&gt; Love TKO
          )
  
      [3] =&gt; Array
          (
              [ACDC] =&gt; Back in Black
          )
  )
  </code></pre>
  <p>I would like to merge the arrays which have duplicate keys, so I can get the following:</p>
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [Michael Jackson] =&gt; Array
              (
                  [0] =&gt; Thriller
                  [1] =&gt; Rock With You
              )
          )
  
      [1] =&gt; Array
          (
              [Teddy Pendergrass] =&gt; Love TKO
          )
  
      [2] =&gt; Array
          (
              [ACDC] =&gt; Back in Black
          )
  )
  </code></pre>
  <p>How do I do this?</p>
  <p>Bonus points for giving me the code to output the array like:</p>
  <pre><code>&lt;h2&gt;Michael Jackson&lt;/h2&gt;
  &lt;ul&gt;
      &lt;li&gt;Thriller&lt;/li&gt;
      &lt;li&gt;Rock With You&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;h2&gt;Teddy Pendergrass&lt;/h2&gt;
  &lt;ul&gt;
      &lt;li&gt;Love TKO&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;h2&gt;ACDC&lt;/h2&gt;
  &lt;ul&gt;
      &lt;li&gt;Back in Black&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>