note 19761 added to function.is-dir
| From: | freeman at otakumail dot com | Date: | Sun, 10 Mar 2002 08:34:13 +0000 |
| Subject: | note 19761 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27574@lists.php.net to get a copy of this message | ||
This function does what it is meant to and without the need to chdir, meaning it does work with full
paths. (i.e. /path/dir)
Directory exists = returns true
Directory doesn't exist = returns nothing
Directory is file = returns false
Directory is a symlink to a file = false
Directory is a symlink to a dir = true
What I found is that the most common error was to use is_dir for seeing whether a directory exists
which will return nothing, so it might seem that the fucntion is buggy, but infact it does exactly
what it's meant to. Someone pointed it out before, just use an else statement to catch the
nothing return.
--
http://www.php.net/manual/en/function.is-dir.php
http://master.php.net/manage/user-notes.php?action=edit+19761
http://master.php.net/manage/user-notes.php?action=delete+19761
http://master.php.net/manage/user-notes.php?action=reject+19761