> I am doing a 'readdir' on a subdirectory. I did my file naming counting on > it ordering based on numbering... But when I do the readdir it isn't doing > it. My naming convention 002_2003_66.jpg would indicate the 66th picture for > the month of Feb in 2003. This gave me automatic sorting. So I thought. But > it doesn't seem to be doing it. The server is a linux server > ((IStop/Doncaster consulting) and I don't see why the ordering is screwing > up. I checked the create dates and that isn't the ordering choosen (I have > pictures from July showing up between pictures from March). > > Thoughts, suggestions? > > Katherine > > This is the clip of code(srcdir being passed in): > > $imgdir = "$srcdir/images"; > $txtdir = "$srcdir/txt"; > $imgdh = opendir($imgdir); > $txtdh = opendir($txtdir); > > while($file = readdir($imgdh)) { > if(substr($file,-3)=="jpg") { > $imgFiles[] = $file; > $textFileName = substr($file,0,-3)."txt"; > $textFiles[] = $textFileName; > } > }
Just sort the $imgFiles array. -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php