Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Date: Sun, 01 Dec 2013 18:32:59 +0100 From: Luuk User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 Newsgroups: comp.lang.php Subject: Re: sorting readdir output? References: <1g1k8whk9o5qm.19jj117exjuzm.dlg@40tude.net> In-Reply-To: <1g1k8whk9o5qm.19jj117exjuzm.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 31 NNTP-Posting-Host: 2001:980:9089:1:492b:9caf:a6b4:6f53 X-Trace: 1385919301 news.xs4all.nl 15984 [2001:980:9089:1:492b:9caf:a6b4:6f53]:32870 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.php:12053 On 01-12-2013 17:39, richard wrote: > > if ($handle = opendir('../audio/1960/')) { > echo "Directory handle: $handle\n"; > echo "Entries:\n"; > > /* This is the correct way to loop over the directory. */ > while (false !== ($entry = readdir($handle))) { > echo "$entry\n
"; > } > > closedir($handle); > } > ?> > > This gives the output in an unsorted list. > How can I make it so the array is sorted? which array? http://us2.php.net/manual/en/language.types.array.php but if you DO have an array, dan sorting is easy: http://us2.php.net/manual/en/function.sort.php > > http://us1.php.net/readdir > yep, it's all in the manual....