|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-22 12:54 UTC] johannes@php.net
-Status: Open
+Status: Bogus
-Package: Feature/Change Request
+Package: *General Issues
[2010-12-22 12:54 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 08:00:01 2025 UTC |
Description: ------------ Currently glob() function returns an array containing the matched files/directories or FALSE on error. There is GLOB_ONLYDIR flag to return only directory entries which match the pattern, but no GLOB_ONLYFILES to get the opposite. Reproduce code: --------------- Valid flags: GLOB_MARK - Adds a slash to each item returned GLOB_NOSORT - Return files as they appear in the directory (no sorting) GLOB_NOCHECK - Return the search pattern if no files matching it were found GLOB_NOESCAPE - Backslashes do not quote metacharacters GLOB_BRACE - Expands {a,b,c} to match 'a', 'b', or 'c' GLOB_ONLYDIR - Return only directory entries which match the pattern Expected result: ---------------- $files = glob("dir/*", GLOB_ONLYFILES); Actual result: -------------- $files = array_diff(glob("dir/*"), glob("dir/*", GLOB_ONLYDIR));