Directory Listing — List all files in a directory
Here’s a small snippet to iterate through an array and get all files in it as an array
function listDir ($dir)
{
$files = array();
$handle = opendir($dir);
while ($file = readdir($handler)) {
if ($file != '.' && $file != '..')
$files[] = $file;
}
closedir($handle);
return $files;
}

