php-doc-en/reference/spl/directoryiterator/construct.xml

93 lines
2.2 KiB
XML
Raw Normal View History

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.5 $ -->
<refentry xml:id="directoryiterator.construct" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>DirectoryIterator::__construct</refname>
<refpurpose>Constructs a new dir iterator from a path</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<constructorsynopsis>
<methodname>DirectoryIterator::__construct</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
</constructorsynopsis>
<para>
Constructs a new directory iterator from a path.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>path</parameter></term>
<listitem>
<para>
The path of the directory to iterate.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>A <methodname>DirectoryIterator::__construct</methodname> example</title>
<para>
This example will list the contents of the directory containing the script.
</para>
<programlisting role="php">
<![CDATA[
<?php
$dir = new DirectoryIterator(dirname(__FILE__));
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
echo 'Filename '.$fileinfo->getFilename().PHP_EOL;
}
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><link linkend="class.splfileinfo">SplFileInfo class</link></member>
<member><link linkend="interface.iterator">Iterator interface</link></member>
</simplelist>
</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
-->