$files = array();
function listFolderFiles($dir) {
$ffs = scandir($dir);
echo '<ol>';
foreach ($ffs as $ff) {
if ($ff != '.' && $ff != '..') {
if (is_dir($dir . '/' . $ff))
listFolderFiles($dir . '/' . $ff);
else
echo '<li>' . $ff;
array_push(
$files,
array(
'file' => $dir . '/' . $ff,
'hash' => hash_file('md5', $dir . '/' . $ff)
)
);
echo '</li>';
}
}
echo '</ol>';
}
listFolderFiles('/var/www');
var_dump($files);
Why am I getting empty output here?
array(0) { };