3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function call(array &$class, string $member, ...$args) { if(!isset($args[1])) { if(!isset($class[$member])) exit($member.' is not a member of the class.'); else { if(!is_callable($class[$member])) return $class[$member]; } } else { } } $Foo = [ 'bar' => 'Hello World' ]; echo(call($Foo, 'bar'));
Output for 7.0.0 - 7.2.0
Hello World
Output for 5.6.8 - 5.6.28
Catchable fatal error: Argument 2 passed to call() must be an instance of string, string given, called in /in/qEQ3g on line 17 and defined in /in/qEQ3g on line 2
Process exited with code 255.
Output for 5.4.11 - 5.5.35
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/qEQ3g on line 2
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '.', expecting '&' or T_VARIABLE in /in/qEQ3g on line 2
Process exited with code 255.