note 3596 modified in language.variables.scope by thiago

From: Date: Fri, 15 Aug 2008 16:50:23 +0000
Subject: note 3596 modified in language.variables.scope by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-143534@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. <?php $foo = "bar"; function baz() { global $foo; # NOTE THIS include("qux"); } ?> --was-- 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://php.net/manual/en/language.variables.scope.php

« previous php.notes (#143534) next »