How do you test to see if a class extends another class by name?
class A { ... }
class B extends A { ... }
class C { ... }
$class_name = 'B';
if (class_extends_another($class_name, 'A')) {
// Yep
}
$class_name = 'C';
if (class_extends_another($class_name, 'A')) {
// Nope
}
I think
is what you’re looking for. Which will return the name of the parent class.
http://www.php.net/manual/en/function.get-parent-class.php