note 97417 deleted from class.recursivedirectoryiterator by danbrown
| From: | danbrown@php.net | Date: | Mon, 19 Apr 2010 14:05:01 +0000 |
| Subject: | note 97417 deleted from class.recursivedirectoryiterator by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-168405@lists.php.net to get a copy of this message | ||
Note Submitter: MikeY
----
@Thriault (on 09-Apr-2010 07:05):
Your code isn't quite correct (although very useful) - The arrays returned by your code when
iterating $Regex were empty. This update however seems to work:
<?php
$Directory = new RecursiveDirectoryIterator($FolderAndPath);
$Iterator = new RecursiveIteratorIterator($Directory);
$Regex = new RegexIterator($Iterator, '/^.+\.php$/i');
foreach ($Regex as $File) {
echo $File, "\n";
}
?>