<?php
if ($handle = opendir('/path/to/files')) {
echo "Directory handle: $handle
";
echo "Files:
";
while (false !== ($file = readdir($handle))) {
echo "$file
";
}
closedir($handle);
}
?>
Now, how do i order the files alphabetically ? For readdir() PHP manual says:
“The filenames are returned in the order in which they are stored by the filesystem.”