Copyright © 2014 by tutorialspoint
string readdir ( resource $dir_handle );
Returns the filename of the next file from the directory. The filenames are returned in the order in which they are stored by the filesystem.
Returns the filename on success, or FALSE on failure.
Following is the usage of this function:
//Open images directory
$dir = opendir("/var/www/images");
//List files in images directory
while (($file = readdir($dir)) !== false)
echo "filename: " . $file . "<br />";
This will produce following result: