List Directory Contents via php

List of files:


<?php 
echo "<h1>List Directory Contents via <abbr title=\"HyperText PreProcessor\">php</abbr></h1>";
if ($handle = opendir('.')) {
  while (false !== ($file = readdir($handle)))
    {
      if ($file != "." && $file != "..")
        {
          $thelist .= '<li><a href="'.$file.'">'.$file.'</a></li>';
        }
    }
  closedir($handle);
} ?>
<p>List of files:</p>
<ul>
<? echo $thelist; ?>
</ul>