Reputation: 28648
Documentation states:
Files are included based on the file path given or, if none is given, the include_path specified. If the file isn't found in the include_path, include() will finally check in the calling script's own directory and the current working directory before failing. The include() construct will emit a warning if it cannot find a file; this is different behavior from require(), which will emit a fatal error.
I'm a little confused by the part of the sentence:
finally check in the calling script's own directory
Example of a tree structure:
index.php
libs
encryption.php
AES.php
My code:
index.php
includes libs/encryption.php
.
In encryption.php
is:
require 'AES.php'; // <-- should this command end with an error?
From what documentation says I would say it should not end with an error but the commands fails in reality.
What is the proper behaviour then?
Thanks!
Upvotes: 0
Views: 76
Reputation: 191729
"The script" in this case refers to the execution script rather than the included module.
Upvotes: 1