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


Groups > comp.lang.php > #12051

Re: sorting readdir output?

From Norman Peelman <npeelman@cfl.rr.com>
Newsgroups comp.lang.php
Subject Re: sorting readdir output?
Date 2013-12-01 11:56 -0500
Organization A noiseless patient Spider
Message-ID <l7fpn4$tf0$1@dont-email.me> (permalink)
References <1g1k8whk9o5qm.19jj117exjuzm.dlg@40tude.net>

Show all headers | View raw


On 12/01/2013 11:39 AM, 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?
>
> http://us1.php.net/readdir
>

   I would think it's be obvious that you need to *SORT* the $entry 
*ARRAY* before you output anything.

-- 
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-

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