0){
// Loop through retuned array
foreach($files as $file){
if(is_file("$path/$file")){
// Display filename
echo "
";
} else if(is_dir("$path/$file")){
// Recursively call the function if directories found
outputFiles("$path/$file");
}
}
} else{
echo "ERROR: No files found in the directory.";
}
} else {
echo "ERROR: The directory does not exist.";
}
}
// Call the function
outputFiles("gallery");
?>