title: Strange behavior of foreach when using reference: foreach ($a as &$v) { ... }
body: <pre><code>&lt;?php
    $a = array('a', 'b', 'c', 'd');
  
    foreach ($a as &amp;$v) { }
    foreach ($a as $v) { }
  
    print_r($a);
  ?&gt;
  </code></pre>
  
  <p>I think it's a normal program but this is the output I am getting:</p>
  
  <pre><code>Array
  (
      [0] =&gt; a
      [1] =&gt; b
      [2] =&gt; c
      [3] =&gt; c
  )
  </code></pre>
  
  <p>Can someone please explain this to me?</p>