3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function compose(/* funs to compose */) { $fl = func_get_args(); return function($x) use($fl) { $val = $x; while (null !== $f = array_pop($fl)) { $val = $f($val); }; return $val; }; } $up = function($s) {return strtoupper($s);}; $y = function($s) {return $s.'!';}; $reverse = function($a) {return array_reverse($a);}; $head = function($a) {return array_shift(array_values($a));}; $data = ['jumpkick', 'roundhouse', 'uppercut']; $c = compose($y, $up, $head, $reverse); var_dump($c($data));
based on Amb0B
Output for 7.0.0 - 7.2.0
Notice: Only variables should be passed by reference in /in/eqaWl on line 17 string(9) "UPPERCUT!"
Output for 5.4.9 - 5.6.28
Strict Standards: Only variables should be passed by reference in /in/eqaWl on line 17 string(9) "UPPERCUT!"
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/eqaWl on line 19
Process exited with code 255.