note 24196 added to function.readdir

From: Date: Thu, 08 Aug 2002 23:54:43 +0000
Subject: note 24196 added to function.readdir
Groups: php.notes 
Request: Send a blank email to php-notes+get-34586@lists.php.net to get a copy of this message
The following snippet doesn't work. The is_file function here doesn't return TRUE for files. However the !is_dir($file) turns up everything that is not a directory such as . and .. and links. What am I doing wrong?! if (false !== ( $dir = opendir($template_path) ) ){ $file_count = 0; while (false !== ( $file = readdir($dir) ) ){ if (is_file($file)){ $file_name[$file_count] = $file; $file_count++; } } } -- http://www.php.net/manual/en/function.readdir.php http://master.php.net/manage/user-notes.php?action=edit+24196 http://master.php.net/manage/user-notes.php?action=delete+24196 http://master.php.net/manage/user-notes.php?action=reject+24196

« previous php.notes (#34586) next »