Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #12054

Re: sorting readdir output?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Date Sun, 01 Dec 2013 18:35:43 +0100
From Luuk <luuk@invalid.lan>
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> <bf8sma-q64.ln1@luuk.invalid.lan>
In-Reply-To <bf8sma-q64.ln1@luuk.invalid.lan>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Message-ID <fk8sma-q64.ln1@luuk.invalid.lan> (permalink)
Lines 36
NNTP-Posting-Host 2001:980:9089:1:492b:9caf:a6b4:6f53
X-Trace 1385919601 news.xs4all.nl 15959 [2001:980:9089:1:492b:9caf:a6b4:6f53]:32874
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.php:12054

Show key headers only | View raw


On 01-12-2013 18:32, Luuk wrote:
> On 01-12-2013 17:39, richard wrote:
>> <?php
>>
>> 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<br>";
>>      }
>>
>>      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....


and there's even an extended manual:
http://lmgtfy.com/?q=how+to+get+a+sorted+list+of+files+in+php&l=1

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

sorting readdir output? richard <noreply@example.com> - 2013-12-01 11:39 -0500
  Re: sorting readdir output? Norman Peelman <npeelman@cfl.rr.com> - 2013-12-01 11:56 -0500
    Re: sorting readdir output? richard <noreply@example.com> - 2013-12-01 12:13 -0500
  Re: sorting readdir output? Luuk <luuk@invalid.lan> - 2013-12-01 18:32 +0100
    Re: sorting readdir output? Luuk <luuk@invalid.lan> - 2013-12-01 18:35 +0100
    Re: sorting readdir output? richard <noreply@example.com> - 2013-12-01 13:10 -0500
      Re: sorting readdir output? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-12-01 13:19 -0500
  Re: sorting readdir output? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-12-01 12:59 -0500
    Re: sorting readdir output? "James Harris" <james.harris.1@gmail.com> - 2013-12-01 18:10 +0000
      Re: sorting readdir output? richard <noreply@example.com> - 2013-12-01 13:19 -0500
  Re: sorting readdir output? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-01 23:41 +0000
  Re: sorting readdir output? Richard Yates <richard@yatesguitar.com> - 2013-12-02 10:54 -0800
    Re: sorting readdir output? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-02 20:24 +0000
      Re: sorting readdir output? Richard Yates <richard@yatesguitar.com> - 2013-12-02 13:02 -0800
        Re: sorting readdir output? Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-02 22:33 +0100
      Re: sorting readdir output? Tim Streater <timstreater@greenbee.net> - 2013-12-02 22:20 +0000
        Re: sorting readdir output? Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-02 23:54 +0000

csiph-web