note 28231 added to function.readdir

From: Date: Mon, 06 Jan 2003 18:53:50 +0000
Subject: note 28231 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-41749@lists.php.net to get a copy of this message
This is a good way to put all your files from a directory in an arry, and echo them on your page. <?php $the_array = Array(); $handle = opendir('.'); while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { /* as descripted below: these "files" will not be added to the array */ $the_array[] = $file; } } closedir($handle); foreach ($the_array as $element) { echo "$element @br /@ \n"; } ?> -- http://www.php.net/manual/en/function.readdir.php http://master.php.net/manage/user-notes.php?action=edit+28231 http://master.php.net/manage/user-notes.php?action=delete+28231 http://master.php.net/manage/user-notes.php?action=reject+28231

« previous php.notes (#41749) next »