git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@55320 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Gabor Hojtsy 2001-08-18 14:07:43 +00:00
parent 0841a9c4d8
commit 8dd65bea75

View file

@ -1,4 +1,4 @@
<!-- $Revision: 1.18 $ -->
<!-- $Revision: 1.19 $ -->
<reference id="ref.dir">
<title>Directory functions</title>
<titleabbrev>Directories</titleabbrev>
@ -62,26 +62,26 @@
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>new <function>dir</function></funcdef>
<funcdef>object <function>dir</function></funcdef>
<paramdef>string <parameter>directory</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
A pseudo-object oriented mechanism for reading a directory. The
given <parameter>directory</parameter> is opened. Two properties
are available once directory has been opened. The handle
are available once the directory has been opened. The handle
property can be used with other directory functions such as
<function>readdir</function>, <function>rewinddir</function> and
<function>closedir</function>. The path property is set to path
the directory that was opened. Three methods are available:
read, rewind and close.
<example>
<title><function>dir</function> Example</title>
<title><function>dir</function> example</title>
<programlisting role="php">
$d = dir("/etc");
echo "Handle: ".$d->handle."&lt;br>\n";
echo "Path: ".$d->path."&lt;br>\n";
while($entry=$d->read()) {
while ($entry = $d->read()) {
echo $entry."&lt;br>\n";
}
$d->close();
@ -159,12 +159,12 @@ $d->close();
</para>
<para>
<example>
<title><function>opendir</function> Example</title>
<title><function>opendir</function> example</title>
<programlisting role="php">
&lt;?php
if ($dir = @opendir("/tmp")) {
while($file = readdir($dir)) {
while ($file = readdir($dir)) {
echo "$file\n";
}
closedir($dir);
@ -201,7 +201,7 @@ if ($dir = @opendir("/tmp")) {
$handle=opendir('.');
echo "Directory handle: $handle\n";
echo "Files:\n";
while (($file = readdir($handle))!==false) {
while (false !== ($file = readdir($handle))) {
echo "$file\n";
}
closedir($handle);
@ -221,8 +221,8 @@ closedir($handle);
</title>
<programlisting role="php">
&lt;?php
$handle=opendir('.');
while (false!==($file = readdir($handle))) {
$handle = opendir('.');
while (false !== ($file = readdir($handle))) {
if ($file != "." &amp;&amp; $file != "..") {
echo "$file\n";
}