title: How do i join an array to itself when a certain value is repeated
body: <p>I have an array that contains items for an employee. Some employees have more than one record, therefore have more than one array. 
  example. There could be a max of 5 records.</p>
  
  <pre><code>[7] =&gt; Array
      (
          [emp_num] =&gt; 13
          [emp_name] =&gt; SMITH, BILL                                  
          [appropriation1] =&gt; 51000550000              
          [hours1] =&gt; 80.00
          [sal/rate1] =&gt; 500.00
          [default_pay] =&gt; Y
          [total_hours] =&gt; 82.00
          [gross] =&gt; 537.50
      )
  
  [8] =&gt; Array
      (
          [emp_num] =&gt; 13
          [emp_name] =&gt; SMITH, Bill                                  
          [appropriation1] =&gt; 51000550005              
          [hours1] =&gt; .00
          [sal/rate1] =&gt; .00
          [default_pay] =&gt;  
          [total_hours] =&gt; 82.00
          [gross] =&gt; 537.50
      )
  </code></pre>
  
  <p>The [appropriation1],[hours1],[sal/rate1] are the only thing that will repeat. So I want to end up with</p>
  
  <pre><code>[7] =&gt; Array
     (
      [emp_num] =&gt; 13
      [emp_name] =&gt; SMITH, BILL                                  
      [appropriation1] =&gt; 51000550000
      [appropriation2] =&gt; 51000550005
      [appropriation3] =&gt; 51000550005
      [appropriation4] =&gt; 51000550005
      [appropriation5] =&gt; 51000550005              
      [hours1] =&gt; 80.00
      [hours2] =&gt; .00
      [hours3] =&gt; .00
      [hours4] =&gt; .00
      [hours5] =&gt; .00
      [sal/rate1] =&gt; 500.00
      [sal/rate2] =&gt; .00
      [sal/rate3] =&gt; .00
      [sal/rate4] =&gt; .00
      [sal/rate5] =&gt; .00
      [default_pay] =&gt; Y
      [total_hours] =&gt; 82.00
      [gross] =&gt; 537.50
  )
  </code></pre>
  
  <p>Would this be easier to do in sql? I only know basic sql, but if I join the table to itself would I be able to create columns rather try to manipulate an array? Or even make a view?</p>
  
  <p>Heres the basic sql</p>
  
  <pre><code> select employeenumber,EMPLOYEENAME, APPROPRIATION, TOTALHOURS as hours, PAYSALRATE, DEFAULTPAYCODE
    from DET
    where RECTYPEIND = 'D'
  </code></pre>