note 25512 deleted from function.opendir by sniper
| From: | sniper@php.net | Date: | Sun, 12 Oct 2003 04:28:18 +0000 |
| Subject: | note 25512 deleted from function.opendir by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58326@lists.php.net to get a copy of this message | ||
Note Submitter: luciano_em_BrazilianTranslation.net
----
The manual says: "If path is not a valid directory, ... opendir() returns FALSE and generates a
PHP error." But that is not entirely true:
- if you call "opendir ()", ie with no arguments, you get an error;
- if you call "opendir ("/some/bogus/dir")", ie with a non-existing directory as
argument, you get an error;
- but if you call opendir with some bogus/unset variable, ie "opendir ($blahblahblah)",
opendir won't mind at all, and will open the script's current directory.
This is useful in shell scripting, if you want to have the script open its current directory and
always be able to copy/move it around without having to worry about particular argument.