3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php Class A { public function __call($method, $args){ $test = & current($args); call_user_func_array([$this, 'test'], $args); } protected function test(&$data) { $data = "done"; } } $data = 42; $a = new A(); $a->test($data); var_dump($data); die();
based on e8SLs
Output for 7.0.0 - 7.2.0
Notice: Only variables should be assigned by reference in /in/tDP0l on line 7 Warning: Parameter 1 to A::test() expected to be a reference, value given in /in/tDP0l on line 8 int(42)
Output for 5.4.11 - 5.6.28
Strict Standards: Only variables should be assigned by reference in /in/tDP0l on line 7 Warning: Parameter 1 to A::test() expected to be a reference, value given in /in/tDP0l on line 8 int(42)
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/tDP0l on line 8
Process exited with code 255.