I have 2 files. Lets say :
first.php
$a = 'blah'; echo 'echo2='.$a; function foo(){ global $a; echo 'echo3='.$a; return $a; } second.php
require_once(path/to/the/file/first.php); echo 'echo='.$a; $b = foo(); echo 'echo4='.$b; running the second.php file I get the following output :
echo=blah echo2=blah echo3= echo4= My question is "why I can't access variable $a in the function foo !
require_once. If you don't give the exact code, you'll only get guesses, not answers. Specifically if the include occurs within a functions local variable scope, the$a=declaration won't be global.register_globalsin php.ini is set to off. Thanks for your answers!