Re: getting filenames from dir

From: Date: Fri, 01 Apr 2005 11:37:30 +0000
Subject: Re: getting filenames from dir
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-212021@lists.php.net to get a copy of this message
Try this function: function scandir($dirstr){
          $files = array();
          $fh = opendir($dirstr);
              while (false !== ($filename = readdir($fh))){
            array_push($files, $filename);}
          closedir($fh);
          return $files;
     }
return an array with all the files in an array... or use scandir() in PHP5 :-) regards jesper Merlin wrote:
Hi there, does anybody know how to get all file names from a specified directory into an array? Thanx, Merlin


« previous php.general (#212021) next »