I’m trying to use the php function method_exists, but I need to check if the method exists in the parent class of an object.
so:
class Parent
{
public function myFunction()
{
/* ... */
}
}
class Child extends Parent
{
/* ... */
}
$myChild = new Child();
if (method_exists($myChild, 'myFunction'))
{
/* ... */
}
if (method_exists(Parent, 'myFunction'))
{
/* ... */
}
if (is_callable(array('Parent', 'myFunction'))
{
/* ... */
}
But none of the above are working. I’m not sure what to try next.
Thanks for any help!
Class child must extend the parent in that case
UpdateThis would have the same effect as method_exists I believe.Just updated from Wrikken‘s post