You could have read even better:

<?php
if ($handle = opendir('.')) {
   while (false !== ($file = readdir($handle))) {
       if ($file != "." && $file != "..") {
           echo "$file\n";
       }
   }
   closedir($handle);
}
?>

This will avoid the "." and ".." elements in the directory, that one usually
does not need.

HTH
INAS, from Brussels
(Ignatius is Not Ander Svensson)
____________________________________________
----- Original Message -----
From: "J.Veenhuijsen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 12, 2003 4:55 PM
Subject: [PHP-WIN] Re: Is there something like findfirst/findnext


> I should have read the manual better.
>
> <?php
>
> if ($dir = @opendir("/tmp")) {
>    while (($file = readdir($dir)) !== false) {
>      echo "$file\n";
>    }
>    closedir($dir);
> }
>
> ?>
>
>
> J.Veenhuijsen wrote:
> > I need to retrieve a list of files (jpg) in a directory.
> > Is there a function like findfirst(*.jpg) like there is in Delphi?
> >
> > Thanks in advance ?
> >
> > Jochem
> >
>
>
> --
> 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