note 86457 added to class.dir
| From: | sojka at online-forum dot net | Date: | Mon, 20 Oct 2008 10:47:02 +0000 |
| Subject: | note 86457 added to class.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-145504@lists.php.net to get a copy of this message | ||
That's the way, I'm storing recursive dirs to an array.
<?php
public static function getTreeFolders($sRootPath = UPLOAD_PATH_PROJECT, $iDepth = 0) {
$iDepth++;
$aDirs = array();
$oDir = dir($sRootPath);
while(($sDir = $oDir->read()) !== false) {
if($sDir != '.' && $sDir != '..' &&
is_dir($sRootPath.$sDir)) {
$aDirs[$iDepth]['sName'][] = $sDir;
$aDirs[$iDepth]['aSub'][] =
self::getTreeFolders($sRootPath.$sDir.'/',$iDepth);
}
}
$oDir->close();
return empty($aDirs) ? false : $aDirs;
}
----
Server IP: 217.160.72.57
Probable Submitter: 85.238.227.114
----
Manual Page -- http://www.php.net/manual/en/class.dir.php
Edit -- https://master.php.net/note/edit/86457
Del: integrated -- https://master.php.net/note/delete/86457/integrated
Del: useless -- https://master.php.net/note/delete/86457/useless
Del: bad code -- https://master.php.net/note/delete/86457/bad+code
Del: spam -- https://master.php.net/note/delete/86457/spam
Del: non-english -- https://master.php.net/note/delete/86457/non-english
Del: in docs -- https://master.php.net/note/delete/86457/in+docs
Del: other reasons-- https://master.php.net/note/delete/86457
Reject -- https://master.php.net/note/reject/86457
Search -- https://master.php.net/manage/user-notes.php