problem with a global variable as class reference
| From: | Wolfram Kriesing | Date: | Sat, 15 Sep 2001 13:38:54 +0000 |
| Subject: | problem with a global variable as class reference | ||
| Groups: | php.general php.pear.general | ||
| Request: | Send a blank email to php-general+get-67444@lists.php.net to get a copy of this message | ||
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