|
Posted by Rik on 06/07/07 15:14
On Thu, 07 Jun 2007 16:56:34 +0200, David T. Ashley <dta@e3ft.com> wrote:
> Hi,
>
> Does require_once() treat "file.inc" and "subdirectory/file.inc" as the
> same
> things or different?
Different, obviously, it searches another directory for the file instead
of the current working directory.
> 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.
It recognizes the exact file you use (how else could PHP actually open the
included/required file?). So no matter how much files are named
'class.php' or 'index.php', each will be recognised as different in their
respective directory.
So to answer the real question: you can divide your library into different
directories all you like, files in different directories with the same
name do not bother the include(_once())/require(_once()) functions.
The only caveat is the if you're used to working with (and are depending
on) a standard include_dir, you might get some unexpected results
--
Rik Wasmus
[Back to original message]
|