note 124683 added to recursiveiteratoriterator.setmaxdepth
| From: | Anonymous@php.net | Date: | Wed, 05 Feb 2020 07:56:27 +0000 |
| Subject: | note 124683 added to recursiveiteratoriterator.setmaxdepth | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-214000@lists.php.net to get a copy of this message | ||
I didn't understand what to do with this statement:
RecursiveIteratorIterator::setMaxDepth ([ int $max_depth = -1 ] ) : void
So, after finding the answer, this is how you incorporate it (for anyone else who was stuck for a
while like me!):
// define the depth of the tree to which you want to search
// where -1 = show all layers below the parent
// and 1 = show the first layer, etc, etc
$max_depth = -1;
// set the path to the directory
$this_directory
// do the search
$recursive = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this_directory));
// now adjust the contents to your desired depth
$recursive->setMaxDepth($max_depth);
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.195 (proxied: 80.169.194.69)
----
Manual Page -- http://php.net/manual/en/recursiveiteratoriterator.setmaxdepth.php
Edit -- https://master.php.net/note/edit/124683
Del: integrated -- https://master.php.net/note/delete/124683/integrated
Del: useless -- https://master.php.net/note/delete/124683/useless
Del: bad code -- https://master.php.net/note/delete/124683/bad+code
Del: spam -- https://master.php.net/note/delete/124683/spam
Del: non-english -- https://master.php.net/note/delete/124683/non-english
Del: in docs -- https://master.php.net/note/delete/124683/in+docs
Del: other reasons-- https://master.php.net/note/delete/124683
Reject -- https://master.php.net/note/reject/124683
Search -- https://master.php.net/manage/user-notes.php