note 37096 added to function.opendir

From: Date: Mon, 03 Nov 2003 07:00:03 +0000
Subject: note 37096 added to function.opendir
Groups: php.notes 
Request: Send a blank email to php-notes+get-59672@lists.php.net to get a copy of this message
I had some problems with example 1, and noticed that the filetype($dir.$file) produced errors. The corrected functional code is as follows(I simply added a / to provide the correct full path): <?php $dir = "/tmp/"; // Open a known directory, and proceed to read its contents if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { print "filename: $file : filetype: " . filetype($dir .'/'. $file) . "\n"; } closedir($dh); } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.opendir.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37096 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37096&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37096&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59672) next »