(PHP 5)
ReflectionClass::isInstantiable — Checks if instantiable
Checks if the class is instanciable.
本函数还未编写文档,仅有参数列表。
此函数没有参数。
成功时返回 TRUE, 或者在失败时返回 FALSE.
Example #1 ReflectionClass::isInstantiable() example
<?php
class C { }
interface iface {
function f1();
}
class ifaceImpl implements iface {
function f1() {}
}
abstract class abstractClass {
function f1() { }
abstract function f2();
}
class D extends abstractClass {
function f2() { }
}
$classes = array("C", "iface", "ifaceImpl", "abstractClass", "D");
foreach($classes as $class ) {
$reflectionClass = new ReflectionClass($class);
echo "Is $class instantiable? ";
var_dump($reflectionClass->IsInstantiable());
}
?>
以上例程会输出:
Is C instantiable? bool(true) Is iface instantiable? bool(false) Is ifaceImpl instantiable? bool(true) Is abstractClass instantiable? bool(false) Is D instantiable? bool(true)