title: PHP Loop Multidimensional Associative Array
body: <p>I have this output:</p>
  
  <p><a href="https://i.stack.imgur.com/AGv7B.png" rel="nofollow"><img src="https://i.stack.imgur.com/AGv7B.png" alt="enter image description here"></a></p>
  
  <p>I don't have any idea how can I make my array look like this:</p>
  
  <pre><code>$array[
  
      0 =&gt; [
          'item_id' =&gt; 6,
          'price' =&gt; "2311.00",
          'qty' =&gt; 12,
          'discount' =&gt; 0
      ],
  
      1 =&gt; [
          'item_id' =&gt; 7,
          'price' =&gt; "1231.00",
          'qty' =&gt; 1,
          'discount' =&gt; 12
      ],
  
      2 =&gt; [
          'item_id' =&gt; 8,
          'price' =&gt; "123896.00",
          'qty' =&gt; 0,
          'discount' =&gt; 24
      ]
  
  
  ]
  </code></pre>
  
  <p>I have started the loop but I don't really know how to get that kind of structure.</p>
  
  <pre><code>    foreach( $array  as $wishlist ){
          foreach( $wishlist as $k =&gt; $v ){
  
          }
      }
  </code></pre>