note 42987 added to function.readdir
| From: | nagash at trumna dot pl | Date: | Sun, 06 Jun 2004 02:11:31 +0000 |
| Subject: | note 42987 added to function.readdir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70740@lists.php.net to get a copy of this message | ||
Simplified recursive file listing (in one directory), with links to the files.
<?
$the_array = Array();
$handle = opendir('prace/.');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$the_array[] = $file;
}
}
closedir($handle);
sort ($the_array);
reset ($the_array);
while (list ($key, $val) = each ($the_array)) {
echo "<a href=prace.php?id=$val>$val</a><br>";
}
?>
I'm not sure, if you were talking about that, but anyway I think somebody might find it usefull
:-)
----
Manual Page -- http://www.php.net/manual/en/function.readdir.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42987
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42987&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42987&report=yes
Search -- http://master.php.net/manage/user-notes.php