Re: sort()-help needed
| From: | �ystein H�land | Date: | Tue, 20 Aug 2002 22:41:21 +0000 |
| Subject: | Re: sort()-help needed | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113389@lists.php.net to get a copy of this message | ||
"Put them into an array and sort() the array. The loop through the sorted
array and output at that point."
Just what I try. But, because of my lack of understanding, the output is my
problem:
function createLinks() {
$p = 0;
$handle=opendir(".");
echo "<UL>\n";
while ($file = readdir($handle)){
$files[] = $file;
$sorted = sort($files);
if (($file == ".") || ($file == "..") || ($file == basename ($PHP_SELF)))
{ continue; }
if(is_file($file)) {
$p++;
$linktext = ucfirst ($file);
$linktext = substr_replace ($linktext,'',-4);
echo "<LI><A HREF=\"$file\">$linktext</A>\n";
}
for($i = 0; $i < $p; $i++) {
//something here
}
echo "</UL>\n";
return true;
}
?>