3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function o($f, $g) { return function (...$x) { return $f(...$g(...$x)); }; } $f = function ($a, $b) { return [$a + $b, $a * $b]; }; $g = function (...$n) { return array_map(function ($n) { return n ** 2; }, $n); }; $h = o($f, $g); var_dump($h(2, 3));
based on uJnif
Output for 7.0.0 - 7.3.0beta1
Notice: Undefined variable: f in /in/JgJOv on line 6 Fatal error: Uncaught Error: Function name must be a string in /in/JgJOv:6 Stack trace: #0 /in/JgJOv(22): {closure}(2, 3) #1 {main} thrown in /in/JgJOv on line 6
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Undefined variable: f in /in/JgJOv on line 6 Fatal error: Uncaught Error: Function name must be a string in /in/JgJOv:6 Stack trace: #0 /in/JgJOv(22): Closure$o() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Undefined variable: f in /in/JgJOv on line 6 Fatal error: Function name must be a string in /in/JgJOv on line 6
Process exited with code 255.