note 18257 deleted from function.define by nlopess

From: Date: Thu, 09 Sep 2004 09:31:26 +0000
Subject: note 18257 deleted from function.define by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76307@lists.php.net to get a copy of this message
Note Submitter: francesco at effects dot it ---- Define is not a preprocessor directive, you can put it into conditional statements, ecc.. This will work: if($lang=='english'){ define(PATH1,'en/file1.txt'); ... } else if($lang=='french') { define(PATH1,'fr/file1.txt'); ... } else { define(PATH1,'int/file1.txt'); ... } require(PATH1); ... You must define the constant before you use it, but in terms of execution time, not file position, again, this works: function test() { echo(TEST); } define(TEST,'defined!'); test();

« previous php.notes (#76307) next »