is_flie & !is_dir

From: Date: Fri, 16 May 2003 21:21:17 +0000
Subject: is_flie & !is_dir
Groups: php.general 
Request: Send a blank email to php-general+get-147978@lists.php.net to get a copy of this message
Hi, I seem to be getting some very strange results with this piece of code. I am trying to list all the files (not directories) in the directory above the current one: if ($handle = opendir('..')) { while (false !== ($file = readdir($handle))) { if(!is_dir($file)){ echo "$file<br>"; } } closedir($handle); } Using this I get all the files in the above directory, but two of the directories as well. If I change if(!is_dir($file)){ to if(is_file($file)){ I get seven out of twenty of the files from the CURRENT directory. This seems completely bizarre! Any comments would be greatly appreciated.

« previous php.general (#147978) next »