note 42634 added to class.dir
| From: | mwb at rn2 dot php dot net | Date: | Mon, 24 May 2004 18:17:43 +0000 |
| Subject: | note 42634 added to class.dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70035@lists.php.net to get a copy of this message | ||
A more anal version or a recursive directory reader/viewer.
<?php
function lsr($dir)
{
$a = array();
if (($d = dir($dir)) != "")
{
while ($file = $d->read())
{
if ($file=='.' || $file=='..')
continue;
if (is_dir("$dir/$file"))
$a[$file] = lsr("$dir/$file");
else
$a[] = $file;
}
}
$d->close();
return $a;
}
function pd($dir,$array) {
while (list($k,$v) = each($array)) {
if (is_array($v))
pd("$dir/$k",$v);
else
print "$dir/$v\n";
}
}
pd(".",lsr("."));
?>
----
Manual Page -- http://www.php.net/manual/en/class.dir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42634
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42634&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42634&report=yes
Search -- http://master.php.net/manage/user-notes.php