php-doc-en/reference/filesystem/functions/glob.xml
Hartmut Holzgraefe f2b3768ed1 glob() and fnmatch() updates
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@96909 c90b9560-bf6c-de11-be94-00142212c4b1
2002-09-26 00:31:29 +00:00

74 lines
2.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.glob">
<refnamediv>
<refname>glob</refname>
<refpurpose>Find pathnames matching a pattern</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>glob</methodname>
<methodparam><type>string</type><parameter>pattern</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
<para>
The <function>glob</function> function searches for all the pathnames
matching <parameter>pattern</parameter> according to the rules used by
the shell. No tilde expansion or parameter substitution is done.
</para>
<para>
Returns an array containing the matched files/directories or &false; on
error.
</para>
<example>
<title>
Convenient way how <function>glob</function> can replace
<function>opendir</function> and friends.
</title>
<programlisting role="php">
<![CDATA[
foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
}
]]>
</programlisting>
<para>
This could result in the following output:
</para>
<screen>
funclist.txt size 44686
funcsummary.txt size 267625
quickref.txt size 137820
</screen>
</example>
<para>
See also <function>opendir</function>,
<function>readdir</function> and
<function>closedir</function>, <function>fnmatch</function>
and the unix manpage on <literal>glob(3)</literal> for flag names
(as long as they are not documented here <!-- TODO hartmut -->).
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->