note 97228 added to class.recursivedirectoryiterator
| From: | Thriault at osu1 dot php dot net | Date: | Fri, 09 Apr 2010 07:05:52 +0000 |
| Subject: | note 97228 added to class.recursivedirectoryiterator | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168059@lists.php.net to get a copy of this message | ||
If you would like to get, say, all the *.php files in your project folder, recursively, you could
use the following:
<?php
$Directory = new RecursiveDirectoryIterator('path/to/project/');
$Iterator = new RecursiveIteratorIterator($Directory);
$Regex = new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
?>
$Regex will contain a single index array for each PHP file.
----
Server IP: 64.71.164.2
Probable Submitter: 76.25.100.26
----
Manual Page -- http://www.php.net/manual/en/class.recursivedirectoryiterator.php
Edit -- https://master.php.net/note/edit/97228
Del: integrated -- https://master.php.net/note/delete/97228/integrated
Del: useless -- https://master.php.net/note/delete/97228/useless
Del: bad code -- https://master.php.net/note/delete/97228/bad+code
Del: spam -- https://master.php.net/note/delete/97228/spam
Del: non-english -- https://master.php.net/note/delete/97228/non-english
Del: in docs -- https://master.php.net/note/delete/97228/in+docs
Del: other reasons-- https://master.php.net/note/delete/97228
Reject -- https://master.php.net/note/reject/97228
Search -- https://master.php.net/manage/user-notes.php