1--TEST-- 2ReflectionClass::IsInstantiable() 3--FILE-- 4<?php 5class noCtor { 6} 7 8class publicCtorNew { 9 public function __construct() {} 10} 11 12class protectedCtorNew { 13 protected function __construct() {} 14} 15 16class privateCtorNew { 17 private function __construct() {} 18} 19 20$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew"); 21foreach ($classes as $class) { 22 $reflectionClass = new ReflectionClass($class); 23 echo "Is $class instantiable? "; 24 var_dump($reflectionClass->IsInstantiable()); 25} 26 27?> 28--EXPECT-- 29Is noCtor instantiable? bool(true) 30Is publicCtorNew instantiable? bool(true) 31Is protectedCtorNew instantiable? bool(false) 32Is privateCtorNew instantiable? bool(false) 33