|
Posted by phpCodeHead on 06/07/07 15:19
On Jun 7, 9:56 am, "David T. Ashley" <d...@e3ft.com> wrote:
> Hi,
>
> Does require_once() treat "file.inc" and "subdirectory/file.inc" as the same
> things or different?
>
> The reason for my question is that I'd like to organize my PHP library into
> subdirectories, and if I accidentally have a naming collision, I'm curious
> how require_once() will behave.
>
> Thanks.
> --
> David T. Ashley (d...@e3ft.com)http://www.e3ft.com (Consulting Home Page)http://www.dtashley.com (Personal Home Page)http://gpl.e3ft.com (GPL Publications and Projects)
Taken directly from the manual.
http://us.php.net/manual/en/function.include.php
Please note that include(), include_once(), require(), and
require_once() all function the same so far as in reference to your
question.
" Files for including are first looked in include_path relative to the
current working directory and then in the directory of the current
script. E.g. if your include_path is libraries, current working
directory is /www/, you included include/a.php and there is include
"b.php" in that file, b.php is first looked in /www/libraries/ and
then in /www/include/. If filename begins with ./ or ../, it is looked
only in include_path relative to the current working directory.
When a file is included, the code it contains inherits the variable
scope of the line on which the include occurs. Any variables available
at that line in the calling file will be available within the called
file, from that point forward. However, all functions and classes
defined in the included file have the global scope. "
HTH,
Gene Kelley
LAMP Software Developer
BizFlowDesigns.com
Navigation:
[Reply to this message]
|