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); unset($ts, $tt); $t1 = $tt-$ts; echo "Variable Instantiation takes {$tt-$ts} seconds\n"; $ts = microtime(true); for ($i=1; $i<=10000; $i++) { echo (new Foo())->bar(); } $tt = microtime(true); unset($ts, $tt); $t2 = $tt-$ts; echo "Magic Instantiation takes {$t2} seconds\n"; echo "\n";
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.23
Parse error: syntax error, unexpected '-', expecting '}' in /in/a59G8 on line 18
Process exited with code 255.

preferences:
181.57 ms | 1395 KiB | 60 Q