is it on a unix system?

if so, do an ls on the system and you will see that the files are listed in
that order.

it is the order in which they were copied to the directory.

try going through a loop before you run your main loop, create an array()
then sort that with some sorting functions and you'll have it.

Jim
----- Original Message -----
From: "Bob Irwin" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 22, 2003 3:03 PM
Subject: [PHP] Reading Directory in reverse


> Hi Guys,
>
> Does anyone happen to know why the below code reads the directory in
reverse
> alphabetical order?  Not a major problem - easy enough to whack it in an
> array and sort it, but annoying nonetheless.
>
>
> $default_dir = "../screenshots";
>
> if (!($dp = opendir($default_dir))) die("cannot open $default_dir");
> while($file = readdir($dp))
>         if($file != '.' && $file != '..') echo"<a
> href='opendir.php?opendir=$file'>$file</a><BR>";
> closedir($dp);
>
> Best Regards
> Bob Irwin
> Server Admin & Web Programmer
> Planet Netcom
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to