title: Transforming array into smaller arrays
body: <p>I've been breaking my head over this problem all day.
  How can I transform the following array:</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [compId] =&gt; 3081
          [category] =&gt; Products
          [rev] =&gt; 0.61
      )
  
  [1] =&gt; Array
      (
          [compId] =&gt; 3080
          [category] =&gt; Plants
          [rev] =&gt; 51
      )
  
  [2] =&gt; Array
      (
          [compId] =&gt; 3080
          [category] =&gt; Products
          [rev] =&gt; 6.1
      )
  )
  </code></pre>
  
  <p>Into an array with this format:</p>
  
  <pre><code>Array( 
  'compId'=&gt;array("3081","3080"), 
  'Products'=&gt;array('0.61', '6.1'), 
  'Plants'=&gt;array('0', '51')
  );
  </code></pre>
  
  <p>The former is being returned by a function. Please note that the 0 in the latter array isn't there in the former array. I do however need to preserve the key values. I've been trying several array functions to make it work but I just cant seem to solve the problem.
  Any help would be very much appreciated.</p>
  
  <p>Let me try elaborating a bit. The latter array is used as input to create a table.
  The table would look like something as:</p>
  
  <pre>
  CompID | Products | Plants
  __________________________
  3081   | 0.61     | 0
  __________________________
  3080   | 6.1      | 51
  </pre>