3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A { function foo($a, $b) {} } $max = 5*1e1; $object = new A; $t = microtime (true); for ($i=0; $i<$max; $i++) { $object->foo(1, 'foo'); } echo $max.' x A::foo: '.round((microtime(true)-$t)*1e3, 2)." ms\n"; $t = microtime (true); for ($i=0; $i<$max; $i++) { call_user_func_array(array($object, 'foo'), array(1, 'foo')); } echo $max.' x call_user_func_array: '.round((microtime(true)-$t)*1e3, 2)." ms\n"; $t = microtime (true); $ref = new ReflectionMethod($object, 'foo'); for ($i=0; $i<$max; $i++) { $ref->invokeArgs($object, array(1, 'foo')); } echo $max.' x ReflectionMethod::invokeArgs: '.round((microtime(true)-$t)*1e3, 2)." ms\n"; $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')); } } echo $max/10.' x (10 x ReflectionMethod::invokeArgs): '.round((microtime(true)-$t)*1e3, 2)." ms\n";
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '' x (10 x ReflectionMethod::in' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /in/rbo2r on line 35
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /in/rbo2r on line 35
Process exited with code 255.