Re: [PHP] sorting results of opendir()

2001-07-09 Thread Don Read
On 09-Jul-01 Steve Edberg wrote: > Here's one way: > > > $dir = opendir('.'); > unset($FileList); > > while ($file=readdir($dir)) { > > if($file!= '.' && $file != '..') > { > $FileList[] = $file; > } > > } > > sort $FileList; > reset($FileList); > > while(list(, $F)

Re: [PHP] sorting results of opendir()

2001-07-09 Thread bleythbe
Just store each $file into an array ($array[] = $file) and the sort($array). Works dandy => Ben Quoting kmurrah <[EMAIL PROTECTED]>: > 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,

Re: [PHP] sorting results of opendir()

2001-07-09 Thread Steve Edberg
Here's one way: $dir = opendir('.'); unset($FileList); while ($file=readdir($dir)) { if($file!= '.' && $file != '..') { $FileList[] = $file; } } sort $FileList; reset($FileList); while(list(, $F) = each($FileList)) { echo "$F\n"; } If you're using

RE: [PHP] sorting results of opendir()

2001-07-09 Thread Jeff Lewis
Why don't you add the $file to an array, then do a sort on the array? sort($array) Jeff > -Original Message- > From: kmurrah [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 09, 2001 2:06 PM > To: [EMAIL PROTECTED] > Subject: [PHP] sorting results of opendir() > > > Greetings. > > I need