method_exists in parent class php
问题 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.