3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() {} } $foo = new Foo(); $method = 'bar'; $args = array(); $iterations = 100000; $start = microtime(true); for($i = 0; $i < $iterations; $i++) { $foo->{$method}($args); } echo 'Calling directly on object: ' microtime(true) - $start . '<br />'; $start = microtime(true); for($i = 0; $i < $iterations; $i++) { call_user_func(array($foo, $method), $args); } echo 'Calling call_user_func: ' . microtime(true) - $start . '<br />';
Output for 5.4.0 - 5.4.16
Parse error: syntax error, unexpected 'microtime' (T_STRING), expecting ',' or ';' in /in/2N11U on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.26
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /in/2N11U on line 21
Process exited with code 255.

preferences:
180.23 ms | 1399 KiB | 51 Q