note 36211 deleted from function.scandir by didou

From: Date: Wed, 22 Oct 2003 07:53:08 +0000
Subject: note 36211 deleted from function.scandir by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59100@lists.php.net to get a copy of this message
Note Submitter: thomas.giersberg@boehringer-ingelheim.co ---- ...and with some extra lines you can avoid "." and ".." on the one hand and list only files with the extension $ext on the other hand function scandir($dirstr, $ext){ $files = array(); $fh = opendir($dirstr); while (false !== ($filename = readdir ($fh))){ if (ereg("$ext", $filename, $regs)){ array_push($files, $filename); } } closedir($fh); return $files; }

« previous php.notes (#59100) next »