<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
  <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>
    <note>
     <para>
      This function is disabled in <link
      linkend="ini.safe-mode">safe mode</link> and therefore will always
      return &false; in <link linkend="ini.safe-mode">safe mode</link>.
     </para>
    </note>
    <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>.
    </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
-->