PHP/Reflection/ReflectionClass
Checking if a class implements an interface using the Reflection classes
interface Nameable {
public function getName();
public function setName($name);
}
class Book implements Nameable {
private $name;
public function getName() {
return $this->name;
}
public function setName($name) {
return $this->name = $name;
}
}
$rc = new ReflectionClass("Book");
if ($rc->implementsInterface("Nameable")) {
print "Book implements Nameable\n";
}