i have the oop php code:
class a {
// with properties and functions
}
class b extends a {
public function test() {
echo __CLASS__; // this is b
// parent::__CLASS__ // error
}
}
$b = new b();
$b->test();
I have a few parent class (normal and abstract) and many child classes. The child classes extend the parent classes. So when I instantiate the child at some point I need to find out what parent I called.
for example the function b::test()
will return a
How can I get (from my code) the class a
from my class b?
thanks