title: How can i split an array into a nested array by splitting each element?
body: <p>My question may not make sense, but after trying all kinds of array_chunk, and explodes, I can't seem to find an easy way to solve my issue.</p>
  
  <p>Ultimately, I have a textarea that I want to be able to enter data like this:</p>
  
  <pre><code>&lt;textarea&gt;
      Song 1 by Artist 1
      Song 2 by Artist 2
      Song 3 by Artist 1
      Song 4 by Artist 3
      Song 5 by Artist 3
  &lt;/textarea&gt;
  </code></pre>
  
  <p>I want to ultimately create an array that I can filter and loop out, and grab each song title and artist title, and have a nested array.</p>
  
  <p>So far, I can use <code>explode( "\n", $source)</code> to create a simple array:</p>
  
  <pre><code>array (size=5)
    0 =&gt; string 'Song 1 by Artist 1' (length=19)
    1 =&gt; string 'Song 2 by Artist 2' (length=19)
    2 =&gt; string 'Song 3 by Artist 1' (length=19)
    3 =&gt; string 'Song 4 by Artist 3' (length=19)
    4 =&gt; string 'Song 5 by Artist 3' (length=18)
  </code></pre>
  
  <p>But I want to now further create an array inside this for each song title and artist title so it will look like:</p>
  
  <pre><code>array (
    0 =&gt; array(
      'title' =&gt; 'Song 1',
      'artist' =&gt; 'Artist 1
    ),
    1 =&gt; array(
      'title' =&gt; 'Song 2',
      'artist' =&gt; 'Artist 2
    )
    etc.
  </code></pre>
  
  <p>How can I expand the initial explode function to be able to loop out the final array values as a list?</p>