I've this sample code:
class A
{
public function A_A() { /* ... */ }
public function A_B() { /* ... */ }
}
class B extends A
{
public function B_A() { /* ... */ }
public function B_B() { /* ... */ }
public function B_C()
{
return get_class_methods($this);
}
}
$a = new A();
$b = new B();
Doing this:
echo '<pre>';
print_r($b->B_C());
echo '</pre>';
Yields the following output:
Array
(
[0] => B_A
[1] => B_B
[2] => B_C
[3] => A_A
[4] => A_B
)
How can I make it return only the following methods?
Array
(
[0] => B_A
[1] => B_B
[2] => B_C
)
I've a method in class A that should call all the methods in class B, the problem is of course that it leads to a infinite loop due to the values returned by get_class_methods()
.