I have the following (stripped down) code:
<?PHP
class A {
function Show(){
echo "ciao";
}
}
$a = new A();
$b = new B();
class B {
function __construct() {
$a->Show();
}
}
?>
With a bit of surprise I cannot access the globally defined $a variable from within the class and I get a Undefined variable exception. Any help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…