Re: Building a list of filenames (w2k)
| From: | Nicole Amashta | Date: | Fri, 08 Feb 2002 15:17:33 +0000 |
| Subject: | Re: Building a list of filenames (w2k) | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-11916@lists.php.net to get a copy of this message | ||
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" <JAsendorf@lcounty.com> wrote in message
news:8A1B14582FF6D511A5DF00B0D022037431B2C2@exchange.lcounty.com...
> 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 - jasendorf@lcounty.com
> 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:fmdev@yahoo.co.uk]
> > Sent: Friday, February 08, 2002 6:09 AM
> > To: php-windows@lists.php.net
> > 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
> >