Nested includes - Relative paths?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux