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


Groups > comp.lang.php > #12053

Re: sorting readdir output?

Date 2013-12-01 18:32 +0100
From Luuk <luuk@invalid.lan>
Newsgroups comp.lang.php
Subject Re: sorting readdir output?
References <1g1k8whk9o5qm.19jj117exjuzm.dlg@40tude.net>
Message-ID <bf8sma-q64.ln1@luuk.invalid.lan> (permalink)

Show all headers | View raw


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....

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