3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function foo($a, $b) {} } function row($name, $t) { printf("%-50s: %01.2f x 10 ┬Ás\n", $name, (microtime(true)-$t)*1e5, 2)); } $max = 5*1e1; $object = new A; $t = microtime (true); for ($i=0; $i<$max; $i++) { $object->foo(1, 'foo'); } row($max.' x A::foo', $t); $t = microtime (true); for ($i=0; $i<$max; $i++) { call_user_func_array(array($object, 'foo'), array(1, 'foo')); } row($max.' x call_user_func_array', $t); $t = microtime (true); $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } row($max.' x ReflectionMethod::invokeArgs', $t); $t = microtime (true); for ($j=0; $j<$max/10; $j++) { $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<10; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } } row(($max/10).' x (10 x ReflectionMethod::invokeArgs)', $t);
Output for 5.3.0 - 5.4.30
Parse error: syntax error, unexpected ')' in /in/erOgJ on line 7
Process exited with code 255.