Is There A Way To glob() Only Files?
I finally found a solution :
echo "Only files\n";
$files = array_filter(glob("/*"), 'is_file');
var_dump($files);
But take care, array_filter will preserve numeric keys : use array_values if you need to reindex the array.
You can use GLOB_BRACE
to match documents against a list of known file extensions:
$files = glob("/path/to/directory/*.{jpg,gif,png,html,htm,php,ini}", GLOB_BRACE);
see: http://www.electrictoolbox.com/php-glob-find-files/
There is an easier way, just one line:
$files = glob("/path/to/directory/*.{*}", GLOB_BRACE);
the {*} means all file endings, so every file, but no folder!