note 3673 deleted from opendir by torben

From: Date: Mon, 04 Sep 2000 20:56:43 +0000
Subject: note 3673 deleted from opendir by torben
Groups: php.notes 
Request: Send a blank email to php-notes+get-4147@lists.php.net to get a copy of this message
It looks as though the int returned by the opendir function is rather random. For example: <pre> //This first directory does not exist $success = opendir("/usr/local/share/httpd/htdocs/msc/photos"); print ("success1 = $success"); //the next two do exist $success = opendir("/usr/local/share/httpd/htdocs/msc"); print ("success2 = $success"); $success = opendir("/tmp"); print ("success3 = $success"); </pre> The output of these lines is (after an error message) as follows: <pre> success1 = success2 = 5success3 = 6 </pre> I was hoping to be able to use this function to test whether a directory exists, as there is no dir_exists function, and I figured that the opendir function might return false if it failed. I'm still curious what the value returned by opendir indicates.

« previous php.notes (#4147) next »