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 "\n"; echo 'call_user_func: '; call_user_func($functionname, &$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/Afasq on line 14
Process exited with code 255.
Output for 5.3.28 - 5.3.29
Deprecated: Call-time pass-by-reference has been deprecated in /in/M7NY3 on line 14 call_user_func_array: call_user_func: 7500 other way: 150
Output for 5.3.0 - 5.3.27
Deprecated: Call-time pass-by-reference has been deprecated in /in/Afasq on line 14 call_user_func_array: call_user_func: 7500 other way: 150