$files = array_filter(scandir($dir), function($item) {
return !is_dir('../folder/pictures/3/' . $item);
});
echo("<pre>".print_r($files,true)."</pre>");
I need to scan a directory but I only need file names and not folders. The code above works great, however when I use it in this way it stops working?
$dir = "..".$config[picurl]."/".$pic_id;
$files = array_filter(scandir($dir), function($item) {
return !is_dir($dir .'/'. $item);
});
Why can't I use the variable $dir?