title: PHP readdir( ) returns " . " and " .. " entries
body: <p>I'm coding a simple web report system for my company. I wrote a script for index.php that gets a list of files in the "reports" directory and creates a link to that report automatically. It works fine, but my problem here is that readdir( ) keeps returning the . and .. directory pointers in addition to the directory's contents. Is there any way to prevent this OTHER THAN looping through the returned array and stripping them manually? </p>
  
  <p>Here is the relevant code for the curious:</p>
  
  <pre><code>//Open the "reports" directory
  $reportDir = opendir('reports');
  
  //Loop through each file
  while (false !== ($report = readdir($reportDir)))
  {
    //Convert the filename to a proper title format
    $reportTitle = str_replace(array('_', '.php'), array(' ', ''), $report);
    $reportTitle = strtolower($reportTitle);
    $reportTitle = ucwords($reportTitle);
  
    //Output link
    echo "&lt;a href=\"viewreport.php?" . $report . "\"&gt;$reportTitle&lt;/a&gt;&lt;br /&gt;";
  }
  
  //Close the directory
  closedir($reportDir);
  </code></pre>