Where to put the include()

From: Date: Wed, 07 Feb 2001 15:26:18 +0000
Subject: Where to put the include()
Groups: php.general 
Request: Send a blank email to php-general+get-38547@lists.php.net to get a copy of this message
Hi, I want to know why in the second file I don't get a=134 as expected. // fileToBeIncluded.php <?PHP $a = 134; function f1() { global $a; echo "a=$a <BR>"; } class smallClass { function smf1() { f1(); } } ?> // file that don't work as expected // print a= <?PHP function f2() { include ('./fileToBeIncluded.php'); f1(); } echo "<html>"; f2(); echo "</html>"; ?> // file that work as expected // print a=134 <?PHP include('./fileToBeIncluded.php'); function f2() { f1(); } echo "<html>"; f2(); echo "</html>"; ?> papaDoc@videotron.ca

« previous php.general (#38547) next »