note 19772 deleted from control-structures.while by sander
| From: | sander@php.net | Date: | Tue, 09 Apr 2002 18:33:37 +0000 |
| Subject: | note 19772 deleted from control-structures.while by sander | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-29026@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