note 19772 added to control-structures.while
| From: | mariovalacca at yahoo dot it | Date: | Sun, 10 Mar 2002 21:24:40 +0000 |
| Subject: | note 19772 added to control-structures.while | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27585@lists.php.net to get a copy of this message | ||
To get the list of the files of a directory use this code:
$dir = opendir('your/directory');
while ($file = readdir($dir)) {
if ($file != '..' && $file !='.'){
echo "$file<br>";
} }
TIP:
To specify the extension of the files that you want to see replace this line:
if ($file != '..' && $file !='.'){
with this:
if ($file != '..' && $file !='.' && ereg(".txt",
$file)){
where .txt is the extension
--
http://www.php.net/manual/en/control-structures.while.php
http://master.php.net/manage/user-notes.php?action=edit+19772
http://master.php.net/manage/user-notes.php?action=delete+19772
http://master.php.net/manage/user-notes.php?action=reject+19772