I want to determine if a class exists and whether or not it implements an interface. Both of the below should work. Which should be preferred and why?
//check if class exists, instantiate it and find out if it implements Annotation
if(class_exists($classname)){
$tmp=new $classname;
if($obj instanceof Annotation) {//do something}
}
//check if class exists, make a reflection of it and find out if it implements Annotation
if(class_exists($classname)){
$r=new new ReflectionClass($classname);
if($r->implementsInterface('Annotation)) {//do something}
}