Re: problem with a global variable as class reference

From: Date: Sat, 15 Sep 2001 13:48:41 +0000
Subject: Re: problem with a global variable as class reference
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67445@lists.php.net to get a copy of this message
My answer may be not well thought but ... from my knowledge, problems with php-gtk you can't assign references to global vars because this particaular declared global variable is a local reference to the global var. - Markus On Sat, Sep 15, 2001 at 03:38:54PM +0200, Wolfram Kriesing wrote : > i am using a global variable (curClass), > which is a reference to some class, > inside another class i want to change > the value of this global variable, to > "point" or refer to another class. > but that doesnt work. > am i doing something wrong??? > > here my code > > ------------------ > class temp > { >   function temp() >   { >     global $curClass; >     $curClass = &${$classNameY}; >   } > } > ------------- > > $curClass = &${classNameX}; > $tempi = new temp(); > # at this point $curClass still points > # to the class with the name "classNameX" > # not to "classNameY" as i would suppose > # if i used: $curClass = $classNameY; > # inside the class temp > # $curClass would have the expected value > # but with the "&${}" around it doenst work > > thanks 4 your help > > Wolfram Kriesing > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, e-mail: pear-general-unsubscribe@lists.php.net > For additional commands, e-mail: pear-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Markus Fischer, http://guru.josefine.at/~mfischer/ EMail: mfischer@guru.josefine.at PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0 -All your scripts are belong to Zend-

« previous php.general (#67445) next »