include1.php
include2.php
main.php
Code: Select all
// include1.php
$global_string = "";Code: Select all
// include2.php
$global_string .= "hello there";Code: Select all
// main.php
include("include1.php");
$global_string .= "blah blah blah..."; // add onto it
// include include2.php, which will add onto it even more
include("include2.php");
print $global_string;Here's the problem: include2.php doesn't know that $global_string exists!
Code: Select all
Notice: Undefined variable: global_string in include2.php