Re: sorting readdir output? [message #183998 is a reply to message #183997] |
Sun, 01 December 2013 16:56 |
Norman Peelman
Messages: 126 Registered: September 2010
Karma:
|
Senior Member |
|
|
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?-
|
|
|