note 32574 deleted from function.include by sniper

From: Date: Tue, 04 Nov 2003 00:42:21 +0000
Subject: note 32574 deleted from function.include by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59791@lists.php.net to get a copy of this message
Note Submitter: pages@inrp.fr ---- As mentionned above by Ivo, it's important to note that when you do nested includes like in: myapp/index.php --------------- <?php include "../smart_functions/main.inc.php"; ?> a_lot_of_smart_functions/main.inc.php ------------------------------------- <?php include "functions_for_this.php"; include "functions_for_that.php"; etc ... ?> PHP will search the file "functions_for_this.php" - first in the "myapp/" directory - and only if it doesn't find it in the "myapp/" directory it will search in the "a_lot_of_smart_functions/" This is in fact a quite annoying "feature" :-( Because if I have a file called "functions_for_this.php" in the "myapp/" directory, then I won't see the functions defined in the file "a_lot_of_smart_functions/functions_for_this.php" anymore. In the worst case, the presence of some files in MY application directory can break a library of functions defined in ANOTHER directory! PS: I know I can replace include "functions_for_this.php"; by include dirname(__FILE__)."/functions_for_this.php"; in "a_lot_of_smart_functions/main.inc.php" but: a. it'ugly, b. the __FILE__ pseudo-constant is undocumented, c. __FILE__ does not work in the same way with every version of PHP.

« previous php.notes (#59791) next »