RE: sorting results of opendir()

From: Date: Mon, 09 Jul 2001 20:21:38 +0000
Subject: RE: sorting results of opendir()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57008@lists.php.net to get a copy of this message
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>"; } > -----Original Message----- > From: kmurrah [mailto:kmurrah@bakergrfx.com] > Sent: Monday, July 09, 2001 11:06 AM > To: php-general@lists.php.net > Subject: sorting results of opendir() > > > Greetings. > > I need to read the contents of a directory, sort it alphabetically, and > display it .... > > i'm doing find on the reading and displaying, but can someone help me with > the sort? >

« previous php.general (#57008) next »