I have two classes :
class A {
public function load() {
$var = new some_class();
return $var;
}
}
and
class B extends A {
public function test() {
$this->load();
$var->some_method(); // ERROR : variable "$var" does not exists
}
}
I want to access the local variable $var of the class “A” from class “B”, how can i do this?
just fill $var with
$this->load();