1--TEST-- 2ReflectionClass::IsInstantiable() 3--FILE-- 4<?php 5class C { 6} 7 8interface iface { 9 function f1(); 10} 11 12class ifaceImpl implements iface { 13 function f1() {} 14} 15 16abstract class abstractClass { 17 function f1() {} 18 abstract function f2(); 19} 20 21class D extends abstractClass { 22 function f2() {} 23} 24 25$classes = array("C", "iface", "ifaceImpl", "abstractClass", "D"); 26 27foreach($classes as $class ) { 28 $reflectionClass = new ReflectionClass($class); 29 echo "Is $class instantiable? "; 30 var_dump($reflectionClass->IsInstantiable()); 31 32} 33 34?> 35--EXPECTF-- 36Is C instantiable? bool(true) 37Is iface instantiable? bool(false) 38Is ifaceImpl instantiable? bool(true) 39Is abstractClass instantiable? bool(false) 40Is D instantiable? bool(true) 41