<?php interface HasTest { public function test(); } class TestClass implements HasTest { public function test() { return 'This is a quick test'; } } $test = array ( 'test' => TestClass ); // !! Using instanceof var_dump($test['test'] instanceof HasTest); var_dump(TestClass instanceof HasTest); // !! Using class_implements var_dump(in_array('HasTest', class_implements($test['test']))); /** * Output: * * bool(false) * bool(false) * bool(true) */ $class = new $test['test']; var_dump($class instanceof HasTest); /** * Output: * bool(true) */
You have javascript disabled. You will not be able to edit any code.