I am trying to build a page that will display a filtered directory listing. I want to display only the files in a directory of a certain type. This is what I have...
$current_dir = "directory/";
$dir = opendir($current_dir);
echo "Directory Listing:<br><hr><br>";
while ($file = readdir($dir))
{
if ($file == "*.ext")
echo "<A HREF=\"$current_dir$file\">$file</A><br>\n";
}
closedir($dir);
Where it says "*.ext", I need to test for files with a certain extension. Can this be done?