Copyright © 2014 by tutorialspoint
void closedir ( resource $dir_handle );
Closes the directory stream indicated by dir_handle. The stream must have previously been opened by opendir().
Returns TRUE 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: