1--TEST-- 2ReflectionClass::__constructor() 3--FILE-- 4<?php 5$r1 = new ReflectionClass("stdClass"); 6 7$myInstance = new stdClass; 8$r2 = new ReflectionClass($myInstance); 9 10class TrickClass { 11 function __toString() { 12 //Return the name of another class 13 return "Exception"; 14 } 15} 16$myTrickClass = new TrickClass; 17$r3 = new ReflectionClass($myTrickClass); 18 19var_dump($r1, $r2, $r3); 20?> 21--EXPECTF-- 22object(ReflectionClass)#%d (1) { 23 ["name"]=> 24 string(8) "stdClass" 25} 26object(ReflectionClass)#%d (1) { 27 ["name"]=> 28 string(8) "stdClass" 29} 30object(ReflectionClass)#%d (1) { 31 ["name"]=> 32 string(10) "TrickClass" 33} 34