3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { return ""; } } $ts = microtime(true); for ($i=1; $i<=10000; $i++) { $c = new Foo(); echo $c->bar(); unset ($c); } $tt = microtime(true); $t1 = $tt-$ts; unset($ts, $tt); echo "Variable Instantiation takes {$t1} seconds\n"; $ts = microtime(true); for ($i=1; $i<=10000; $i++) { echo (new Foo())->bar(); } $tt = microtime(true); $t2 = $tt-$ts; unset($ts, $tt); echo "Magic Instantiation takes {$t2} seconds\n"; echo "\n";

preferences:
35.79 ms | 402 KiB | 5 Q