title: My PHP foreach code is not working properly
body: <p>I found that in PHP I can use two types of foreach.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>$p2 = array('copier' =&gt; "Copier &amp; Multipurpose",  
      'inkjet' =&gt; "Inkjet Printer",            
      'laser' =&gt; "Laser Printer",              
      'photo' =&gt; "Photographic Paper");
  
  echo "p2 element: " . $p2['inkjet'] . "&lt;br&gt;";
  
  foreach ($p2 as $item =&gt; $desc)          
  {                                           
      echo "$item -&gt; $desc &lt;br /&gt;";
  }
  
  echo "&lt;br /&gt;";
  
  while (list($item, $desc) = each($p2))              
  {
      echo "$item -&gt; $desc &lt;br /&gt;";
  }  
  </code></pre>
  
  <p>The second while loop does not iterate over the items.  Why?</p>