3v4l.org

run code in 300+ PHP versions simultaneously
<?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));
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.15
Parse error: syntax error, unexpected '}' in /in/Amb0B on line 17
Process exited with code 255.

preferences:
162.48 ms | 1395 KiB | 22 Q