3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public function bar($x,$y){ return $x*y; }; } $s = microtime(true); $foo = new foo(); for($x = 0; $x < 10000; $x++ ){ call_user_func(array($foo, 'bar'), 10,20); } echo round(microtime(true) - $s,5)."\n"; $s = microtime(true); $foo = new foo(); $met = 'bar'; for($x = 0; $x < 10000; $x++ ){ $foo->$bar(10,20); } echo round(microtime(true) - $s,5)."\n";
Output for 5.4.0 - 5.4.17
Parse error: syntax error, unexpected ';', expecting function (T_FUNCTION) in /in/kRtjl on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /in/kRtjl on line 6
Process exited with code 255.

preferences:
163.27 ms | 1399 KiB | 53 Q