title: Last iteration values left in array
body: <pre><code>  if ($cart = $this-&gt;cart-&gt;contents())
    {
          foreach ($cart as $item){
              $order_detail = array(
                  'res_id'        =&gt;$this-&gt;session-&gt;userdata('menu_id[]'),
                  'customer_id'   =&gt;$coustomers,
                  'payment_id'    =&gt;$payment,
                  'name'          =&gt; $item['name'],
                  'productid'     =&gt; $item['id'],
                  'quantity'      =&gt; $item['qty'],
                  'price'         =&gt; $item['price'],
                  'subtotal'      =&gt; $item['subtotal']
              );  
              }
              print_r($order_detail); exit;
  </code></pre>
  
  <p>when the <code>foreach</code> loop ends, only the last iteration value is left. I need all the values to be within the array.</p>