title: listing files in folder showing index.php
body: <p>I have this code, but it is showing the index.php itself How can I filter *.php files?</p>
  
  <pre><code>&lt;?php
      if ($handle = opendir('.')) {
      while (false !== ($file = readdir($handle)))
      {
          if ($file != "." &amp;&amp; $file != "..")
          {
              $thelist .= '&lt;LI&gt;&lt;a href="'.$file.'"&gt;'.$file.'&lt;/a&gt;';
          }
      }
      closedir($handle);
      }
  ?&gt;
  
  &lt;P&gt;Dir:&lt;/p&gt;
  &lt;UL&gt;
  &lt;P&gt;&lt;?=$thelist?&gt;&lt;/p&gt;
  &lt;/UL&gt;
  </code></pre>
  
  <p>Also is there a way to sort them by modification or creation time?</p>