3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $bar = 'bar'; } $foo = new Foo; $rounds = 1000000; $start = microtime(true); for($i=0; $i<$rounds; $i++) { $var = $foo->bar; } echo (microtime(true) - $start); echo "\n"; $start = microtime(true); $refl = new ReflectionProperty('Foo', 'bar'); for($i=0; $i<$rounds; $i++) { $var = $refl->getValue($foo); } echo (microtime(true) - $start); echo "\n"; $start = microtime(true); for($i=0; $i<$rounds; $i++) { $var = (new ReflectionProperty('Foo', 'bar'))->getValue($foo); } echo (microtime(true) - $start);

preferences:
31.49 ms | 402 KiB | 5 Q