YOu should do a:

reset($retVal);

after doing that rsort($retVal);

================

## Load Directory Into Array
 $path = "D:Program Files/Adobe/Acrobat 4.0/PDF Output/";
 $handle=opendir($path);
 while ($file = readdir($handle))
 $retVal[count($retVal)] = $file;

## Clean up and reverse sort
 closedir($handle);
 rsort($retVal);
reset($retVal);            ## new line added here; reset the array before
using it.
 echo "<table>";
 while (list($key, $file) = each($retVal)) {

       $flename = "$file";
 echo "<tr><td>$flename</td></tr>";

======================



"John Asendorf" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I'm sure I stole this code from somewhere else...
>
> file://Load Directory Into Array
> $path = "D:Program Files/Adobe/Acrobat 4.0/PDF Output/";
> $handle=opendir($path);
> while ($file = readdir($handle))
> $retVal[count($retVal)] = $file;
>
> file://Clean up and reverse sort
> closedir($handle);
> rsort($retVal);
> echo "<table>";
> while (list($key, $file) = each($retVal)) {
>
>       $flename = "$file";
> echo "<tr><td>$flename</td></tr>";
>
> }
>
>
>
> ---------------------
> John Asendorf - [EMAIL PROTECTED]
> Web Applications Developer
> http://www.lcounty.com - NEW FEATURES ADDED DAILY!
> Licking County, Ohio, USA
> 740-349-3631
> Nullum magnum ingenium sine mixtura dementiae fuit
>
>
> > -----Original Message-----
> > From: George Pitcher [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, February 08, 2002 6:09 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-WIN] Building a list of filenames (w2k)
> >
> >
> > Hi all,
> >
> > I want to build a list of filenames from a particular
> > directory. I can't
> > find anything like this in the manual or on the list archive
> > so any pointers
> > would be appreciated.
> >
> > George
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >



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

Reply via email to