note 59618 rejected from function.sort by dmytton

From: Date: Sun, 11 Dec 2005 15:10:31 +0000
Subject: note 59618 rejected from function.sort by dmytton
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-99954@lists.php.net to get a copy of this message
Note Submitter: djbobke at cvbijdehand dot nl ---- I have a problem please help.. I am not so good in php, i want to sort my files i have them in an array but when i sort them i get this: 1 10 11 12 13 14 15 16 17 18 19 2 20 etc. how do i make it good... <?php if ($dir = opendir("./img/")) { while (($file = readdir($dir)) !== false) { if(!is_dir($file) && strstr($file,".")){ $FilesArr[]=$file; } } closedir($dir); } $Hor = 4; $Vert = 3; if(isset($FilesArr)){ sort($FilesArr); $CountFiles = count($FilesArr); $Pages = ceil($CountFiles / ($Hor * $Vert)); if(isset($_GET['page'])){ $i=$_GET['page']*($Hor*$Vert); $Max = $i+($Hor*$Vert); if($Max > $CountFiles){ $Max = $CountFiles; } }else{ $i=0; $Max = $Hor*$Vert; if($Max > $CountFiles){ $Max = $CountFiles; } } ?> <center> <table> <? $x=0; $y=0; for($i=$i;$i<=$Max-1;$i++){ $x++; if($x==1){ echo"<tr>"; $y++; } echo"<td><a href=\"out.php?file=".$FilesArr[$i]."&c=".$CountFiles."\"> <img border=\"0\" width=\"150\" src=\"pic.php?file=".$FilesArr[$i]."\"></a></td>"; if($x==$Hor){ echo"</tr>"; $x=0; } } ?>

« previous php.notes (#99954) next »