>Your example does _not_ show this, it works
>as expected and throws a notice, from which can be inferred there is other
>code doing this

Or relevant code having a side-effect not currently realized.

>Is your class maybe inheriting from another one and that contains the code
>causing this issue?


>>May I infer that the declaration of $GLOBALS['hello'] will, at the same
>>time, also create $hello (without a statement declaring such)?
>The $GLOBALS array is what's known as a super global. Elements within the
>array are reflected as global variables and vice-versa.

Let's refine the conceptual example:

class Hello {
private $_world = 'World';
function __construct(){}

$GLOBALS['hello'] = new Hello();

echo 'The variable $hello is '.gettype($hello)."\n".print_r($hello,true);

Can we then postulate that the value of $GLOBALS['hello'] will also be revealed 
in $hello, even though $hello was never formally declared?

I know that $GLOBALS['hello'] has a universal scope, and $hello (wherever it 
comes from) needs to be global-ized inside functions.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to