note 3596 modified in Variable scope by ronabop
| From: | ronabop@php.net | Date: | Wed, 13 Dec 2000 06:12:50 +0000 |
| Subject: | note 3596 modified in Variable scope by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8674@lists.php.net to get a copy of this message | ||
If you include a file from within a function using include(), the included file inherits the
function scope as its own global scope, it will not be able to see top level globals unless they are
explicit in the function.
$foo = "bar";
function baz() {
global $foo; # NOTE THIS
include("qux");
}
http://www.php.net/manual/variable-scope.php