File tree Expand file tree Collapse file tree 1 file changed +33
-6
lines changed
reference/filesystem/functions Expand file tree Collapse file tree 1 file changed +33
-6
lines changed Original file line number Diff line number Diff line change 1919 the libc glob() function, which is similar to the rules used by common
2020 shells.
2121 </para >
22+ <simpara >
23+ The behavior on Unix systems and macOS is determined by the system's
24+ implementation of glob(). On Windows, an implementation that conforms
25+ to the POSIX 1003.2 definition for glob() is used, and it includes
26+ an extension to handle the <literal >[!...]</literal > convention for
27+ negating a range.
28+ </simpara >
2229 </refsect1 >
2330
2431 <refsect1 role =" parameters" >
7885 <para >
7986 Returns an array containing the matched files/directories, an empty array
8087 if no file matched or &false; on error.
88+ Unless <literal >GLOB_NOSORT</literal > was used, the names will
89+ be sorted alphanumerically.
8190 </para >
82- <note >
83- <para >
84- On some systems it is impossible to distinguish between empty match and an
85- error.
86- </para >
87- </note >
8891 </refsect1 >
8992
9093 <refsect1 role =" examples" >
@@ -110,6 +113,30 @@ foreach (glob("*.txt") as $filename) {
110113funclist.txt size 44686
111114funcsummary.txt size 267625
112115quickref.txt size 137820
116+ ]]>
117+ </screen >
118+ </example >
119+ <example >
120+ <title >
121+ Example with a more complex pattern
122+ </title >
123+ <programlisting role =" php" >
124+ <![CDATA[
125+ <?php
126+ foreach (glob("path/*/*.{txt,md}", \GLOB_BRACE) as $filename) {
127+ echo "$filename\n";
128+ }
129+ ?>
130+ ]]>
131+ </programlisting >
132+ &example.outputs.similar;
133+ <screen >
134+ <![CDATA[
135+ path/docs/mailinglist-rules.md
136+ path/docs/README.md
137+ path/docs/release-process.md
138+ path/pear/install-pear.txt
139+ path/Zend/README.md
113140]]>
114141 </screen >
115142 </example >
You can’t perform that action at this time.
0 commit comments