Re: global variables as reference

From: Date: Sat, 22 Sep 2001 01:40:23 +0000
Subject: Re: global variables as reference
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-68242@lists.php.net to get a copy of this message
http://www.php.net/manual/en/language.references.arent.php I stopped reading after the manual said "You can't do that", but there's a user-contributed note on a work-around that you may want to read. Disclaimer: I don't really grok & in PHP yet, so I just don't use it. :-p -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm ----- Original Message ----- From: Wolfram Kriesing <wolfram.kriesing@web.de> Newsgroups: php.general To: <pear-genereal@lists.php.net>; <php-general@lists.php.net> Sent: Friday, September 14, 2001 10:12 AM Subject: global variables as reference > 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 > _______________________________________________________________________ > 1.000.000 DM gewinnen - kostenlos tippen - > http://millionenklick.web.de > IhrName@web.de, 8MB Speicher, Verschluesselung - > http://freemail.web.de > >

« previous php.general (#68242) next »