note 41125 added to function.readdir
| From: | wouter-php at fort-knox dot rave dot org | Date: | Wed, 31 Mar 2004 04:34:32 +0000 |
| Subject: | note 41125 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-67399@lists.php.net to get a copy of this message | ||
gehring[at-no-2-spam]egotec.com: nice example. I'm sure it's just a typo, but just a note
for confused new users though: Change
if($file !== "." or $file !== "..") {
to:
if($file !== "." and $file !== "..") {
... otherwise you'll end up with an infinite loop.
(! (x or y)) -or- (!x and !y).
And throw out the "$append" line, AFAIK.
I don't know what this will do to recursing symlinks and other fun stuff, though, so anybody
reading this and wanting to do something similar, might want to consider a max_recursions parameter.
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41125
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41125&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41125&report=yes
Search -- http://master.php.net/manage/user-notes.php