title: PHP foreach echos a specific array item twice
body: <p>I take a PHP basics course in teamtreehouse.com and in this course I learn about PHP loops. Regarding PHP <code>foreach</code> loop, I wrote this code which works fine:</p>
  
  <pre><code>&lt;?php
  
  $items = array(
      'item1' =&gt; 'X',
      'item2' =&gt; 'Y',
  );
  
  foreach ($items as $item) {
      echo $item . "&lt;br&gt;";
  }
  </code></pre>
  
  <blockquote>
    <p>X</p>
    
    <p>Y</p>
  </blockquote>
  
  <p>And yet, when I try to target a specific item after iterating foreach element this way:</p>
  
  <pre><code>foreach ($items as $item) {
      echo $items['item1'];
  }
  </code></pre>
  
  <p>The output is <code>XX</code> instead just <code>X</code>.</p>
  
  <p>My question is why I got <code>XX</code> in the first place and an answer could help me understand how to extract the specific value I want (the value of the first key-value pair - <code>X</code>) with <code>foreach</code>.</p>