Let's say I hava a page index.php and in it I execute:
require_once("file1.php");
echo $myVar;
in file1.php I have:
require_once("file2.php");
and in file2.php I have
$myVar = "test";
After executing this script, index.php can't get to $myVar and outputs undefined variable. Any reason on that ?
$myVarthat you're not putting here. As it stands this problem can't be reproduced by your example.require_oncewill only include the file if it has not already been included.