note 25623 deleted from function.require by sniper
| From: | sniper@php.net | Date: | Sat, 18 Jan 2003 15:33:16 +0000 |
| Subject: | note 25623 deleted from function.require by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42358@lists.php.net to get a copy of this message | ||
I don't believe this is in the docs, so here it goes.
If require() is called from a require()'d file AND the argument to it is just a filename, it
will first try to read the file from the directory the parent script is in. If it can't find
it, it will try to read the file from the directory the child script is in.
Example:
-Parent Script (/home/user/public_html/parent.php) -> require('child.php')
--Child Script (/home/user/child.php) -> require('findme.php')
---Find Me Script (/home/user/findme.php)
First PHP will search /home/user/public_html/findme.php for the file, if it can't find it, it
will resort to the directory of the require'd file (/home/user/) and look for it there. Nice
little feature, I wasn't sure why it was working ;-)