note 57147 added to ref.spl
| From: | helly@php.net | Date: | Sun, 25 Sep 2005 09:41:36 +0000 |
| Subject: | note 57147 added to ref.spl | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95746@lists.php.net to get a copy of this message | ||
There is a RecursiveFilterIterator that makes the above code much easier. And then ther is
ParentIterator thta is already a filtering recursive iterator that only accepts elements that have
children, with a RecursiveDirectoryIterator as inner iterator you would obviously get only the
directories. Further more it ensures that it creates the correct children. All in all you simply
need to do this:
$it = RecursiveDirectoryIterator($path);
$it = ParentIterator($it);
$it = new RecursiveIteratorIteator($it);
foreach($it as $dir => $o) { ... }
----
Manual Page -- http://www.php.net/manual/en/ref.spl.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57147
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57147&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57147&report=yes
Search -- http://master.php.net/manage/user-notes.php