php check if method overridden in child class

To get this information, you have to use ReflectionClass. You could try getMethod and check the class name of the method.

$class = new ReflectionClass($this);
$method = $class->getMethod("yourMethod");
if ($method->class == 'classname') {
    //.. do something
}

But keep in mind, that reflection isn't very fast, so be careful with usage.


Check if the declaring class matches the class of the object:

$reflector = new \ReflectionMethod($ob, 'createTable');
$isProto = ($reflector->getDeclaringClass()->getName() !== get_class($ob));

PHP Manual links:

  • ReflectionMethod
  • ReflectionProperty