note 42987 deleted from function.readdir by tularis
| From: | tularis@php.net | Date: | Sun, 13 May 2007 19:05:06 +0000 |
| Subject: | note 42987 deleted from function.readdir by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126537@lists.php.net to get a copy of this message | ||
Note Submitter: nagash at trumna dot pl
----
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
:-)