title: PHP basename() removing variable, strange effect
body: <p>I have a strange bug where in the following code where the basename() is complete removing the <code>$file</code>:</p>
  
  <pre><code>$files = glob(DIR_APPLICATION . 'controller/module/*.php');
  
  if ($files) {
  
      foreach ($files as $file) {
  
          $extension = basename($file, '.php');
          print($file).'&lt;br /&gt;';
  </code></pre>
  
  <p>When debuging, if I add the <code>print()</code> code above the <code>basename</code> it works as expected. If I add it below it completely removing the <code>$file</code>. </p>
  
  <p>What could be the reason for this?</p>
  
  <pre><code>if ($files) {
  
      foreach ($files as $file) {
  
          echo $file . '&lt;br /&gt;';
          var_dump($file);
          echo '&lt;br /&gt;';
          $extension = basename($file, '.php');
          var_dump($file);
          echo '&lt;br /&gt;&lt;br /&gt;';
  </code></pre>
  
  <p>PHP Version 5.3.10</p>