3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function dontSwitch($option) { $actions = array( '*' => 'multiply', '/' => 'divide', '*/' => 'shit' ); return call_user_func($actions[$option]); } function multiply() { return 'fuuuuu'; } function divide() { return 'dump'; } function multdiv() { return 'shit'; } echo dontSwitch('*/');
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Warning: call_user_func() expects parameter 1 to be a valid callback, function 'shit' not found or invalid function name in /in/CSSQ8 on line 8
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid argument: function: method 'shit' not found in /in/CSSQ8 on line 8
Output for 4.3.2 - 5.2.17
Warning: call_user_func(shit): First argument is expected to be a valid callback in /in/CSSQ8 on line 8
Output for 4.3.0 - 4.3.1
Warning: call_user_func(shit) [http://www.php.net/function.call-user-func]: First argument is expected to be a valid callback in /in/CSSQ8 on line 8