class A
{
function foo()
{
if (isset($this)) {
echo '$this is defined (';
echo get_class($this);
echo ")\n";
} else {
echo "\$this is not defined.\n";
}
}
}class B
{
function bar()
{
A::foo();
}
}$a = new A();
$a->foo();
A::foo();
$b = new B();
$b->bar();
B::bar();
{
function foo()
{
if (isset($this)) {
echo '$this is defined (';
echo get_class($this);
echo ")\n";
} else {
echo "\$this is not defined.\n";
}
}
}class B
{
function bar()
{
A::foo();
}
}$a = new A();
$a->foo();
A::foo();
$b = new B();
$b->bar();
B::bar();
class b
{
function b()
{
$this->a = new a();
}
function doSth()
{
$this->a->method_in_a_class();
}
}