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

From: Date: Mon, 09 Jul 2001 20:51:19 +0000
Subject: RE: [PHP] RE: sorting results of opendir()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57009@lists.php.net to get a copy of this message
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++] = $file; > } > > sort($dirlist); > > foreach($dirlist as $file){ > echo "$file<br>"; > } > > errmmm ... $ls=ls; echo nl2br($ls); Regards, -- Don Read dread@texas.net -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it.

« previous php.general (#57009) next »