<?
if ($dir = @opendir("animals"))
{
while (($file = readdir($dir)) !== false)
{
if($file != ".." && $file != "." && $file != "index.html")
{
$filelistan[] = $file;
}
}
closedir($dir);
}
?>
<?
krsort($filelistan);
while (list ($key, $val) = each ($filelistan))
for($i=0;$i<5;$i++){
echo "<a href='animals/$filelistan[$i]'>$filelistan[$i]</a><br>\n";
}
?>
it works but it keeps on looping the top 5, anyway to fix this