note 121098 deleted from function.readdir by peehaa
| From: | peehaa@php.net | Date: | Fri, 19 May 2017 12:54:39 +0000 |
| Subject: | note 121098 deleted from function.readdir by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209068@lists.php.net to get a copy of this message | ||
Note Submitter: someguy at overthere dot com
----
For Example 2 I had to use nl2br to get a new line. Also in this modified example I've added a
variable to specify the dir rather than leave it as . for the current dir.
<?PHP
$dir = "files/";
if ($handle = opendir($dir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
echo nl2br("$entry\n");
}
}
closedir($handle);
}
?>