title: PHP: Using scandir(), folders are treated as files
body: <p>Using PHP 5.3.3 (stable) on Linux CentOS 5.5.</p>
  
  <p>Here's my folder structure:</p>
  
  <pre><code>www/myFolder/
  www/myFolder/testFolder/
  www/myFolder/testFile.txt
  </code></pre>
  
  <p>Using scandir() against the "myFolder" folder I get the following results:</p>
  
  <pre><code>.
  ..
  testFolder
  testFile.txt
  </code></pre>
  
  <p>I'm trying to filter out the folders from the results and only return files:</p>
  
  <pre><code>$scan = scandir('myFolder');
  
  foreach($scan as $file)
  {
      if (!is_dir($file))
      {
          echo $file.'\n';
      }
  }
  </code></pre>
  
  <p>The expected results are:</p>
  
  <pre><code>testFile.txt
  </code></pre>
  
  <p>However I'm actually seeing:</p>
  
  <pre><code>testFile.txt
  testFolder
  </code></pre>
  
  <p>Can anyone tell me what's going wrong here please?</p>