RE: [PHP] Problem with is_dir function

From: Date: Tue, 05 Nov 2002 16:41:19 +0000
Subject: RE: [PHP] Problem with is_dir function
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-122793@lists.php.net to get a copy of this message
On Saturday, November 02, 2002 11:07 AM, I wrote * > I'm having a problem with the is_dir function, or maybe I don't understand > how it supposed to work. I'm using the following code to check whether or > not a directory called $user_dir exists. If it exists, I am returned the > proper message. But if it doesn't exist, I get the following error message > that says that it doesn't exist. (I already knew that!) > <ERROR Number="8" Description="Error: &quot;stat failed for > /home/sites/home/users/demodocs/web/userforum/user > (errno=2 - No such file or directory)&quot; on line 175 of > /home/sites/home/users/demo/web/user_forum/messages.php."/ > Can someone please explain what I am doing wrong here, and how to return a > usable value if the directory doesn't exist. > $test = is_dir($user_dir); > if($test){echo "You have a user directory. It is $user_dir";} > else{echo "Your user directory doesn't exist"; > return;} > Thanks a lot. > Roger Lewis This is a follow-up to my original posting. * I did not get an answer as to why is_dir does not return a "false" value; however, file_exists does the job nicely. Thanks for all the suggestions. * Roger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#122793) next »