title: PHP: Foreach echo not showing correctly
body: <p>The output should look like this:</p>
  
  <pre><code>1. Yougurt 4 units price 2000 CRC
  </code></pre>
  
  <p>But I'm currently getting this:</p>
  
  <pre><code>item. Y Y unitsYquantity. 3 3 units3code. S S unitsSprice. units
  </code></pre>
  
  <p>This is the script:</p>
  
  <pre><code>    &lt;?php
  
  session_start();
  
  //Getting the list
  $list[]= $_SESSION['list'];
  
  
  //stock
  $products = array(
  
        'Pineaple' =&gt; 500, 'Banana' =&gt; 50, 'Mango' =&gt; 150, 
        'Milk' =&gt; 500, 'Coffe' =&gt; 1200, 'Butter' =&gt; 300,
        'Bread' =&gt; 450, 'Juice' =&gt; 780, 'Peanuts' =&gt; 800,
        'Yogurt' =&gt; 450, 'Beer' =&gt; 550, 'Wine' =&gt; 2500,
    );
  
  //Saving the stuff
  $_SESSION['list'] = array(
      'item' =&gt; ($_POST['product']), 
      'quantity' =&gt; ($_POST['quantity']),
      'code' =&gt; ($_POST['code']),
  );
  
  //price
  $price = $products[($_SESSION['list']['item'])] * $_SESSION['list']['quantity'];
  
  $_SESSION['list']['price'] = $price;
  
  
  //listing
  echo  "&lt;b&gt;SHOPPIGN LIST&lt;/b&gt;&lt;/br&gt;";
  
  foreach($_SESSION['list'] as $key =&gt; $item) 
  {
      echo $key, '. ', $item['item'], ' ', $item['quantity'], ' units', $item['price'];
  }
  
  //Recycling list
  $_SESSION['list'] = $list;
  
  echo "&lt;/br&gt; &lt;a href='index.html'&gt;Return to index&lt;/a&gt; &lt;/br&gt;";
  
  
  //Printing session
  print_r($_SESSION);
  
  ?&gt;
  </code></pre>