Nested includes - Relative paths?
| From: | Nuno Vaz Oliveira | Date: | Wed, 08 Nov 2006 03:50:13 +0000 |
| Subject: | Nested includes - Relative paths? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-244357@lists.php.net to get a copy of this message | ||
Hi All,
I'm relatively new to PHP but I've had some training and feel quite confortable programming it...
Anyway, I'm having a problem in understanding the correct behaviour of the include statement/function.
Imagine that I have an INDEX.PHP file in my root directory and I want to include the file INCLUDE\SESSION.PHP. I would use the statement:
<?php include 'include/session.php'; ?>What if, inside the file INCLUDE\SESSION.PHP I want to include the file INCLUDE\DATABASE.PHP? Should I use the statement:
<?php include 'database.php'; ?>because DATABASE.PHP and SESSION.PHP are in the same directory or should I use the statement:
<?php include 'include/database.php'; ?>because INCLUDE\SESSION.PHP is going to be included in INDEX.PHP witch is NOT in the same directory of DATABASE.PHP? In other words... When PHP processes an include statement does it include the file where the include statement is and then process its contents (eventualy including other files) or does PHP processes the file to be included and only includes it after that? Thanks