RE: [PHP] RE: sorting results of opendir()

2001-07-09 Thread Don Read
On 09-Jul-01 Andrew Chase wrote: > Try reading the directory contents into an array, sorting it, *then* > outputting the contents of the array: > > $dir = opendir("."); > > $dirlist = array(); > $index = 0; > while($file = readdir($dir) && $file != "." && $file != ".."){ > $dirlist[$index

[PHP] RE: sorting results of opendir()

2001-07-09 Thread Andrew Chase
Try reading the directory contents into an array, sorting it, *then* outputting the contents of the array: $dir = opendir("."); $dirlist = array(); $index = 0; while($file = readdir($dir) && $file != "." && $file != ".."){ $dirlist[$index++] = $file; } sort($dirlist); foreach($dirlist