3v4l.org

run code in 200+ php & hhvm versions
<?php class MyClass { public static function doSomething() { echo "Did it!\n"; } } $r = new ReflectionMethod('MyClass', 'doSomething'); $args = array(); $r->invoke('WTF?', array()); $r->invokeArgs('MyClass', $args);
based on JVqif
Output for 7.1.0 - 7.2.6
Warning: ReflectionMethod::invoke() expects parameter 1 to be object, string given in /in/e9h1S on line 13 Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in /in/e9h1S on line 14
Output for 5.6.0 - 7.0.20
Did it! Warning: ReflectionMethod::invokeArgs() expects parameter 1 to be object, string given in /in/e9h1S on line 14