title: Create multidimensional array from csv
body: <p>I am having trouble generating a multidimensional array from a csv file. I need to have the output 'grouped' by country as each country may have multiple networks. Some rows do not have a value for country or zone as they are related to the row above it. Unfortunately this is how i receive the csv file and there is no way of changing the output. Any feedback or pointers would be appreciated.</p>
  
  <p><strong>Snippet of csv file...</strong></p>
  
  <pre><code>Country|Zone|Network|Video|Voice
  Afghanistan,5,Afghan Wireless,No,Yes
  ,,Roshan,No,Yes
  Antigua,4,Digicel,No,Yes
  Argentina,5,Telecom Personal,Yes,Yes
  ,,Movistar,No,Yes
  ,,Movistar2,Yes,Yes
  Aruba,4,Digicel,No
  </code></pre>
  
  <p><strong>Ideal Output</strong></p>
  
  <pre><code>Array (
      [0] =&gt; Array (
          [country] =&gt; Afghanistan
          [zone] =&gt; 5
          [network] =&gt; Array (
              [0] =&gt; Array (
                  [name] =&gt; Afghan Wireless
                  [video] =&gt; No
                  [voice] =&gt; Yes
              )
              [1] =&gt; Array (
                  [name] =&gt; Roshan
                  [video] =&gt; No
                  [voice] =&gt; Yes
              )
          )
      )
      [1] =&gt; Array (
          [country] =&gt; Antigua
          [zone] =&gt; 4
          [network] =&gt; Array (
              [0] =&gt; Array (
                  [name] =&gt; Digicell
                  [video] =&gt; No
                  [voice] =&gt; Yes
              )
          )
      )
      etc...
  )
  </code></pre>