readdir() sort in php

Associate
Joined
4 Nov 2002
Posts
902
Location
NE Scotland
I'm having great difficulty sorting an array in php. Can anybody help me please:


Code:
echo "  var pixList=new Array();\n";
$dir=opendir($albums_root_dir."/".$album_dir);
$i=0;
while($entry=readdir($dir)) if(is_image($albums_root_dir."/".$album_dir."/".$entry)){

  echo "  pixList[".$i."]=".get_MAImage($albums_root_dir."/".$album_dir."/".$entry,$max_miniature_width,$max_miniature_height,'').";\n";
  echo "  pixList[".($i++)."].imageFile='".$entry."'\n;";
 
Last edited:

Sic

Sic

Soldato
Joined
9 Nov 2004
Posts
15,365
Location
SO16
readdir() doesnt actually (seem to) read the contents of a directory into an array. it reads through a directory in the order that the file system lists it, after opening with opendir().

take a look at those sections of the PHP manual and if you're still having trouble after that, post back :)
 
Back
Top Bottom