Re: strange stuff in a class
| From: | Richard Lynch | Date: | Thu, 11 Jul 2002 09:22:19 +0000 |
| Subject: | Re: strange stuff in a class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-107079@lists.php.net to get a copy of this message | ||
>> class test {
>> function test() {
>> $globals['test2'] = &$this;
>> }
>> }
>> $test1 = new test();
>>
>> The problem hier is that $globals['test2'] is a copy of
>> $globals['test1'] not a
>> references.
>
>Use "$GLOBALS" rather than "$globals"
I think he's building his own "pool" of objects for object-management in
$globals, rather than trying to set the value of $test2...
And mucking directly with $GLOBALS is morally wrong :-)
global $test2;
$test2 = &$this;
if that's what you wanted to do, which I don't think it is.
Of course, you *will* need:
global $globals;
if you expect this code to do anything useful.
--
Like Music? http://l-i-e.com/artists.htm
Off-Topic: What is the moral equivalent of 'cat' in Windows?