3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function timesTwo($num, $callback) { $num = $num*2; echo "num from timesTwo: ".$num.PHP_EOL; return call_user_func($callback, $num); } function addOne($num) { echo 'Num from add 1: '.$num.PHP_EOL; return $num + 1; } echo timesTwo(5, 'addOne'); ?>
based on pXQIN
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0alpha1
num from timesTwo: 10 Num from add 1: 10 11