2010/12/9 Ángel González <keis...@gmail.com>:

>> Not to mention, I have had issues (and I can't reproduce it properly
>> or I would report it) where sometimes i will have a variable in global
>> scope in one file, and I have to reference it as $GLOBALS['variable']
>> in another include, or I have to global $variable; in the include to
>> be able to get to it, and I'm not quite sure why.

> Is that second file included inside a function?

No, that would make some sense. This is a loose example, and like I
said it's not consistent, and I can't figure out good ways to model
why I run into this once in a while.

fileA.php:

$foo = 'bar';
require fileB.php;


fileB.php:

echo $foo; <- doesn't work

echo $GLOBALS['foo']; <- works

global $foo;
echo $foo; <- works

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to