FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » sorting readdir output?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: sorting readdir output? [message #184001 is a reply to message #184000] Sun, 01 December 2013 17:35 Go to previous messageGo to previous message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma:
Senior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: dropdown menus
Next Topic: Re: SEO SERVICES
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 04:24:46 GMT 2024

Total time taken to generate the page: 0.05105 seconds