PHP:在哪里放置rsort


PHP: Where to put rsort?

$count = 0;
if ($handle = opendir('./arkiv/')) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            $count++;
            print("<a href='"arkiv/".$file."'">".basename($file, ".php")."</a><br />'n");
        }
    }
    echo '<br /><br /><a href=".">Tilbake</a>';
    closedir($handle);
}

这是我正在使用的代码,我正试图找出在哪里但'排序',但这对我来说是非常新的,有人能帮助我吗?

可能的用法如下

$count = 0;
         $fileArray = array();
         if ($handle = opendir('./arkiv/')) 
         {
            while (false !== ($file = readdir($handle))) 
            {
               if ($file != "." && $file != "..") 
               {  
                  $count++;
                  $fileArray[] = $file; 
               }
            }
            rsort($fileArray);
            foreach($fileArray as $file)
            {
               print("<a href='"arkiv/".$file."'">".basename($file, ".php")."</a><br />'n");
            }
            echo '<br /><br /><a href=".">Tilbake</a>';
            closedir($handle);
         }

试试吧....祝你好运!!