If I have $var defined in Page1.php and in Page2.php I have
//Page2.php include('Page1.php'); echo $var;
For what reasons will it not print the value of $var to the screen? The files are in the same directory so paths shouldn’t be the issue. I’ve checked the php.ini file and nothing really jumps out at me. Any ideas?
If it were a path problem you would see a warning in your error log. You could also change to require instead of include and it would become obvious.
You can also print your working directory to figure out what’s wrong.
Is $var created in a function? If so, make sure you have
before the first assignment in that function.