note 124116 added to class.recursivedirectoryiterator
| From: | flaurora_sonora@php.net | Date: | Thu, 15 Aug 2019 23:30:15 +0000 |
| Subject: | note 124116 added to class.recursivedirectoryiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-211889@lists.php.net to get a copy of this message | ||
Do not waste your time with this. I have included a function below that accomplishes the same thing
more simply. If you want to do regex while iterating you can pass the regex into the recursive
function as a parameter.
<?php
function recursive_read($directory, $entries_array = array()) {
if(is_dir($directory)) {
$handle = opendir($directory);
while(FALSE !== ($entry = readdir($handle))) {
if($entry == '.' || $entry == '..') {
continue;
}
$Entry = $directory . DS . $entry;
if(is_dir($Entry)) {
$entries_array = recursive_read($Entry, $entries_array);
} else {
$entries_array[] = $Entry;
}
}
closedir($handle);
}
return $entries_array;
}
?>
----
Server IP: 208.43.231.9
Probable Submitter: 82.199.157.54 (proxied: 24.37.39.82)
----
Manual Page -- http://php.net/manual/en/class.recursivedirectoryiterator.php
Edit -- https://master.php.net/note/edit/124116
Del: integrated -- https://master.php.net/note/delete/124116/integrated
Del: useless -- https://master.php.net/note/delete/124116/useless
Del: bad code -- https://master.php.net/note/delete/124116/bad+code
Del: spam -- https://master.php.net/note/delete/124116/spam
Del: non-english -- https://master.php.net/note/delete/124116/non-english
Del: in docs -- https://master.php.net/note/delete/124116/in+docs
Del: other reasons-- https://master.php.net/note/delete/124116
Reject -- https://master.php.net/note/reject/124116
Search -- https://master.php.net/manage/user-notes.php