note 21423 deleted from function.readdir by sander

From: Date: Mon, 13 May 2002 12:40:15 +0000
Subject: note 21423 deleted from function.readdir by sander
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-30581@lists.php.net to get a copy of this message
Files are returned in the order that they are on the filesystem. This piece of code will list all files apart from index.php in the current directory: $filelist = array(); $handle = opendir('.'); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != "index.php") { array_push($filelist, " <a href=\"$file\">$file</a><br>\n"); } } closedir($handle); asort ($filelist); reset ($filelist); while (list ($key, $val) = each ($filelist)) { echo "$val"; }

« previous php.notes (#30581) next »