3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function by_ref(&$arg) { $arg = 42; } class ModuleHandler { public function invokeAll($hook, &$args) { by_ref($args[0]); } } $moduleHandler = new ModuleHandler(); $moduleHandler->invokeAll('example', array(23)); $array = array(25); $moduleHandler->invokeAll('example', $array); var_dump($array);
based on 0CJDU
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Cannot pass parameter 2 by reference in /in/aU4bS:14 Stack trace: #0 {main} thrown in /in/aU4bS on line 14
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Fatal error: Cannot pass parameter 2 by reference in /in/aU4bS on line 14
Process exited with code 255.