I have a problem with script when I scan a folder because array contains sub directories as well:
$location = 'c:\test';
$files = scandir($location , 1);
but i would like to scan only files but not folders
I have a problem with script when I scan a folder because array contains sub directories as well:
$location = 'c:\test';
$files = scandir($location , 1);
but i would like to scan only files but not folders
You can use this. It filters out all directories.
$result = array_filter(scandir('/path/to/dir'), function($item) {
return !is_dir('/path/to/dir/' . $item);
});