How do i return an array with the file names from folder? I have this till now but doesn't work.
function showFiles($path) {
$folder = "gallery/$path";
$i = 0;
if (is_dir($folder)) {
if ($handle = opendir($folder)) {
while (($file = readdir($handle)) != FALSE) {
if ($file === "." || $file === ".." || $file === "index.html") { continue; }
if (!in_array($file, array('.', '..')) && !is_dir($folder.$file))
$arrayName = array($file);
foreach ($arrayName as $fileArr) {
$files[] = $fileArr;
print_r($files);
}
}
return $files;
closedir($handle);
}
}
}
Any help will be appreciated :)