svn: /phpdoc/en/trunk/reference/dir/functions/ readdir.xml

From: Date: Sun, 04 Dec 2011 23:34:54 +0000
Subject: svn: /phpdoc/en/trunk/reference/dir/functions/ readdir.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9149@lists.php.net to get a copy of this message
frozenfire Sun, 04 Dec 2011 23:34:54 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=320392 Log: Clarified that readdir will return all entries in a directory, not just the files. Updated examples to reflect that. Closes bug #60443. Bug: https://bugs.php.net/60443 (Open) Readdir also returns folders Changed paths: U phpdoc/en/trunk/reference/dir/functions/readdir.xml Modified: phpdoc/en/trunk/reference/dir/functions/readdir.xml =================================================================== --- phpdoc/en/trunk/reference/dir/functions/readdir.xml 2011-12-04 23:23:15 UTC (rev 320391) +++ phpdoc/en/trunk/reference/dir/functions/readdir.xml 2011-12-04 23:34:54 UTC (rev 320392) @@ -14,8 +14,8 @@ <methodparam choice="opt"><type>resource</type><parameter>dir_handle</parameter></methodparam> </methodsynopsis> <para> - Returns the filename of the next file from the directory. The - filenames are returned in the order in which they are stored by + Returns the name of the next entry in the directory. The + entries are returned in the order in which they are stored by the filesystem. </para> </refsect1> @@ -42,7 +42,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - Returns the filename on success&return.falseforfailure;. + Returns the entry name on success&return.falseforfailure;. </para> &return.falseproblem; </refsect1> @@ -51,7 +51,7 @@ &reftitle.examples; <para> <example> - <title>List all files in a directory</title> + <title>List all entries in a directory</title> <para> Please note the fashion in which <function>readdir</function>'s return value is checked in the examples below. We are explicitly @@ -68,16 +68,16 @@ if ($handle = opendir('/path/to/files')) { echo "Directory handle: $handle\n"; - echo "Files:\n"; + echo "Entries:\n"; /* This is the correct way to loop over the directory. */ - while (false !== ($file = readdir($handle))) { - echo "$file\n"; + while (false !== ($entry = readdir($handle))) { + echo "$entry\n"; } /* This is the WRONG way to loop over the directory. */ - while ($file = readdir($handle)) { - echo "$file\n"; + while ($entry = readdir($handle)) { + echo "$entry\n"; } closedir($handle); @@ -90,16 +90,16 @@ <para> <example> <title> - List all files in the current directory and strip out <literal>.</literal> + List all entries in the current directory and strip out <literal>.</literal> and <literal>..</literal> </title> <programlisting role="php"> <![CDATA[ <?php if ($handle = opendir('.')) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != "..") { - echo "$file\n"; + while (false !== ($entry = readdir($handle))) { + if ($entry != "." && $entry != "..") { + echo "$entry\n"; } } closedir($handle);

« previous php.doc.cvs (#9149) next »