str2; } public function setState($value) { $this->str3 = $value; } public static function moo() { echo 'moo'; } } $limit = 10000000; $start = microtime(true); for($i = 0; $i < $limit; $i++) { $reflected = new \ReflectionClass('Foo'); unset($reflected); } $reflected1 = microtime(true) - $start; $class = new Foo(); $start = microtime(true); for($i = 0; $i < $limit; $i++) { $reflected = new \ReflectionClass($class); unset($reflected); } $reflected2 = microtime(true) - $start; $start = microtime(true); for($i = 0; $i < $limit; $i++) { $arr = [1,2,3]; unset($arr); } $array = microtime(true) - $start; echo 'Reflection with string: ' . $reflected1 . PHP_EOL; echo 'Reflection with object: ' . $reflected2 . PHP_EOL; echo 'Array creation: ' . $array . PHP_EOL;