Is there a way define a global variable which is accesible from a class method?
Posted
by Starx
on Stack Overflow
See other posts from Stack Overflow
or by Starx
Published on 2010-05-14T07:16:11Z
Indexed on
2010/05/14
7:24 UTC
Read the original article
Hit count: 233
Here is the situation I create a instance of a class
$newobj = new classname1;
Then I have another class writtern below and I want to this class to access the object above
class newclass {
public function test() {
echo $newobj->display();
}
}
It is not allowed, is there a way define a variable globally through a class?
© Stack Overflow or respective owner