Directory browser

Displays all files in the directory that the script resides

<?php
//open the current directory
$directory = opendir('.');
while ($file = readdir($directory))
{
$filenames[] = $file;
}
foreach ($filenames as $file)
{
echo "$file<br>";
}
?>