note 73145 added to function.glob
| From: | viajy at yoyo dot org | Date: | Sat, 10 Feb 2007 12:50:55 +0000 |
| Subject: | note 73145 added to function.glob | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123217@lists.php.net to get a copy of this message | ||
this is a recursive function i wrote to return an array of all subdirectories of a dir
function listdirs($dir) {
static $alldirs = array();
$dirs = glob($dir . '/*', GLOB_ONLYDIR);
if (count($dirs) > 0) {
foreach ($dirs as $d) $alldirs[] = $d;
}
foreach ($dirs as $dir) listdirs($dir);
return $alldirs;
}
example:
print_r(listdirs('/some/path'));
----
Server IP: 130.206.1.5
Probable Submitter: 213.139.18.22
----
Manual Page -- http://www.php.net/manual/en/function.glob.php
Edit -- https://master.php.net/note/edit/73145
Del: integrated -- https://master.php.net/note/delete/73145/integrated
Del: useless -- https://master.php.net/note/delete/73145/useless
Del: bad code -- https://master.php.net/note/delete/73145/bad+code
Del: spam -- https://master.php.net/note/delete/73145/spam
Del: non-english -- https://master.php.net/note/delete/73145/non-english
Del: in docs -- https://master.php.net/note/delete/73145/in+docs
Del: other reasons-- https://master.php.net/note/delete/73145
Reject -- https://master.php.net/note/reject/73145
Search -- https://master.php.net/manage/user-notes.php