title: is_dir does not recognize folders
body: <p>I am trying to make a function that scans a folder for subfolders and then returns
  a numeric array with the names of those folders.</p>
  
  <p>This is the code i use for testing. Once i get it to print out the folder names and not just "." and ".." for present and above folder all will be well, and I can finish the function.</p>
  
  <pre><code>&lt;?php
  function super_l_getthemes($dir="themes")
  {
  
  if ($handle = opendir($dir)) {
      echo "Handle: {$handle}\n";
      echo "Files:\n";
  
  
      while (false !== ($file = readdir($handle))) {
         echo "{$file}&lt;br&gt;";
      }
  
      closedir($handle);
  }
  ?&gt;
  </code></pre>
  
  <p>The above code works fine, and prints out all the contents of the folder: files, subfolders and the "." and ".."</p>
  
  <p>but if i replace:</p>
  
  <pre><code>  while (false !== ($file = readdir($handle))) {
         echo "{$file}&lt;br&gt;";
      }
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>while (false !== ($file = readdir($handle))) {
          if(file_exists($file) &amp;&amp; is_dir($file)){echo "{$file}";}
      }
  </code></pre>
  
  <p>The function only prints "." and ".." , not the two folder names that I'd like it to print.</p>
  
  <p>Any help is appreciated.</p>