note 114997 added to class.filesystemiterator
| From: | paul at paulgarvin dot net | Date: | Sat, 10 May 2014 15:08:52 +0000 |
| Subject: | note 114997 added to class.filesystemiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199505@lists.php.net to get a copy of this message | ||
You may be wondering, like I did, what is the difference between this class and DirectoryIterator?
When you iteterate using DirectoryIterator each "value" returned is the same
DirectoryIterator object. The internal state is changed so when you call isDir(), getPathname(), etc
the correct information is returned. If you were to ask for a key when iterating you will get an
integer index value.
FilesystemIterator (and RecursiveDirectoryIterator) on the other hand returns a new, different
SplFileInfo object for each iteration step. The key is the full pathname of the file. This is by
default. You can change what is returned for the key or value using the "flags" arguement
to the constructor.
----
Server IP: 72.52.91.14
Probable Submitter: 66.249.88.182 (proxied: 98.114.54.90)
----
Manual Page -- http://php.net/manual/en/class.filesystemiterator.php
Edit -- https://master.php.net/note/edit/114997
Del: integrated -- https://master.php.net/note/delete/114997/integrated
Del: useless -- https://master.php.net/note/delete/114997/useless
Del: bad code -- https://master.php.net/note/delete/114997/bad+code
Del: spam -- https://master.php.net/note/delete/114997/spam
Del: non-english -- https://master.php.net/note/delete/114997/non-english
Del: in docs -- https://master.php.net/note/delete/114997/in+docs
Del: other reasons-- https://master.php.net/note/delete/114997
Reject -- https://master.php.net/note/reject/114997
Search -- https://master.php.net/manage/user-notes.php