3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { static function bar($a) { echo $a; } } $r = new ReflectionClass('foo'); $m = $r->getMethod('bar'); $m->invokeArgs('some_other_class_name', ['baz']); $m->invokeArgs(42, ['baz']); $m->invokeArgs(new DateTime, ['baz']); $m->invokeArgs($r, ['baz']);
based on 8o4Hm
Output for 5.6.0 - 7.2.6
Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in /in/n8cad on line 13 Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, integer given in /in/n8cad on line 14 bazbaz