Open and read the contents of a directory, excluding the special entries “.” and “..”.
Source Code
if ($handle = opendir('path/to/directory')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo "$entryn";
}
}
closedir($handle);
}