note 23404 deleted from function.is-dir by goba

From: Date: Wed, 14 Aug 2002 21:34:29 +0000
Subject: note 23404 deleted from function.is-dir by goba
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35040@lists.php.net to get a copy of this message
PHP 4.1.2 Apache 1.3.23 Red Hat Linux 7.3 This code will list all files in a directory whether they are directories or regular files. It *should* omit directories and show only regular files: $dir = opendir("/home/username/public_html/some_directory"); while (($file = readdir($dir)) !== false) { if (!is_dir($file)) { echo "<option value=\"".$file."\">".$file."</option>"; } } closedir($dir); I tried the following workaround with the same results: $dir = opendir("/home/username/public_html/some_directory"); while (($file = readdir($dir)) !== false) { if (is_file($file)) { echo "<option value=\"".$file."\">".$file."</option>"; } } closedir($dir); Is this a bug, or am I not using the functions correctly in the above examples?

« previous php.notes (#35040) next »