title: Create duplicate arrays based on a column value
body: <p>I have the following array, the first item in the array has a quantity of 3 while the rest has a quantity of 1. These numbers are dynamic.</p>
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [id] =&gt; 39235995
              [quantity] =&gt; 3
              [price] =&gt; 2.81
          )
  
      [1] =&gt; Array
          (
              [id] =&gt; 39236029
              [quantity] =&gt; 1
              [price] =&gt; 2.952
          )
  
      [2] =&gt; Array
          (
              [id] =&gt; 39236015
              [quantity] =&gt; 1
              [price] =&gt; 3.333
          )
  
      [3] =&gt; Array
          (
              [id] =&gt; 39235997
              [quantity] =&gt; 1
              [price] =&gt; 2.667
          )
  
  )
  </code></pre>
  <p>How can I change that to the following output? So the first item that did have a quantity of 3 is now separated out into 3 array items and the quantity set to one for each?</p>
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [id] =&gt; 39235995
              [quantity] =&gt; 1
              [price] =&gt; 2.81
          )
  
      [1] =&gt; Array
          (
              [id] =&gt; 39235995
              [quantity] =&gt; 1
              [price] =&gt; 2.81
          )
  
      [2] =&gt; Array
          (
              [id] =&gt; 39235995
              [quantity] =&gt; 1
              [price] =&gt; 2.81
          )
          
      [3] =&gt; Array
          (
              [id] =&gt; 39236029
              [quantity] =&gt; 1
              [price] =&gt; 2.952
          )
  
      [4] =&gt; Array
          (
              [id] =&gt; 39236015
              [quantity] =&gt; 1
              [price] =&gt; 3.333
          )
  
      [5] =&gt; Array
          (
              [id] =&gt; 39235997
              [quantity] =&gt; 1
              [price] =&gt; 2.667
          )
  
  )
  </code></pre>