From 99a5cc447fc5ab7c3deeeb6f7462f9891bc86852 Mon Sep 17 00:00:00 2001 From: Justin Martin Date: Sun, 4 Dec 2011 23:34:54 +0000 Subject: [PATCH] Clarified that readdir will return all entries in a directory, not just the files. Updated examples to reflect that. Closes bug #60443. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@320392 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/dir/functions/readdir.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/reference/dir/functions/readdir.xml b/reference/dir/functions/readdir.xml index 106a61a7fc..280861150d 100644 --- a/reference/dir/functions/readdir.xml +++ b/reference/dir/functions/readdir.xml @@ -14,8 +14,8 @@ resourcedir_handle - 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. @@ -42,7 +42,7 @@ &reftitle.returnvalues; - Returns the filename on success&return.falseforfailure;. + Returns the entry name on success&return.falseforfailure;. &return.falseproblem; @@ -51,7 +51,7 @@ &reftitle.examples; - List all files in a directory + List all entries in a directory Please note the fashion in which readdir'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 @@ if ($handle = opendir('/path/to/files')) { - 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>