3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo{ public static function Bar($num){ $num*=50; } } $functionname = "Foo::Bar"; $num = 3; echo 'call_user_func_array: '; call_user_func_array($functionname, array(&$num)); echo $num; echo "\n"; $num = 3; echo "other way: "; if (stristr($functionname, '::') !== false) { list($class, $function) = explode('::', $functionname); $class::$function(&$num); } else { $functionname(&$num); } echo $num;
Output for 5.4.0 - 5.4.17
Fatal error: Call-time pass-by-reference has been removed in /in/U2f0A on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Deprecated: Call-time pass-by-reference has been deprecated in /in/U2f0A on line 21 Deprecated: Call-time pass-by-reference has been deprecated in /in/U2f0A on line 23 call_user_func_array: 150 other way: 150