note 72773 added to class.dir
| From: | thomas at hawkes dot ca | Date: | Thu, 01 Feb 2007 02:10:09 +0000 |
| Subject: | note 72773 added to class.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-122466@lists.php.net to get a copy of this message | ||
With SPL, you could recursively list all of the folders inside the current directory like this:
<?php
$it = new RecursiveDirectoryIterator('./');
// RecursiveIteratorIterator accepts the following modes:
// LEAVES_ONLY = 0 (default)
// SELF_FIRST = 1
// CHILD_FIRST = 2
foreach (new RecursiveIteratorIterator($it, 2) as $path) {
if ($path->isDir()) {
echo "$path\n";
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 72.1.217.156 (proxied: 127.0.0.1)
----
Manual Page -- http://www.php.net/manual/en/class.dir.php
Edit -- https://master.php.net/note/edit/72773
Del: integrated -- https://master.php.net/note/delete/72773/integrated
Del: useless -- https://master.php.net/note/delete/72773/useless
Del: bad code -- https://master.php.net/note/delete/72773/bad+code
Del: spam -- https://master.php.net/note/delete/72773/spam
Del: non-english -- https://master.php.net/note/delete/72773/non-english
Del: in docs -- https://master.php.net/note/delete/72773/in+docs
Del: other reasons-- https://master.php.net/note/delete/72773
Reject -- https://master.php.net/note/reject/72773
Search -- https://master.php.net/manage/user-notes.php