PHP list directories and remove .. and 
<p>I created a script that list the directories in the current directory</p>

<pre><code>&lt;?php
   $dir = getcwd(); 
   if($handle = opendir($dir)){
       while($file = readdir($handle)){
          if(is_dir($file)){
             echo "&lt;a href=\"$file\"&gt;$file&lt;/a&gt;&lt;br /&gt;";
            }
       }
?&gt;
</code></pre>

<p>but the problem is, I am seeing this ".." and "." right above the directory listings, when someone clicks it, they get redirected one level up the directories.. can someone tell me how to remove those ".." and "." ?</p>
