3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $items = array( array( array("Color" => "Blue"), array("Size" => "S") ), array( array("Color" => "Blue"), array("Size" => "M") ) ); $new_items = array_map(function ($item) { return array_map(function ($key_values) { return array_reduce($key_values, function ($seed, $value, $key) { $seed[$key] = $value; }); }, $item); }, $items);
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 2 passed and exactly 3 expected in /in/d7URn:14 Stack trace: #0 [internal function]: {closure}(NULL, 'Blue') #1 /in/d7URn(16): array_reduce(Array, Object(Closure)) #2 [internal function]: {closure}(Array) #3 /in/d7URn(17): array_map(Object(Closure), Array) #4 [internal function]: {closure}(Array) #5 /in/d7URn(18): array_map(Object(Closure), Array) #6 {main} thrown in /in/d7URn on line 14
Process exited with code 255.
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 3 for {closure}() in /in/d7URn on line 14 Notice: Undefined variable: key in /in/d7URn on line 15 Warning: Missing argument 3 for {closure}() in /in/d7URn on line 14 Notice: Undefined variable: key in /in/d7URn on line 15 Warning: Missing argument 3 for {closure}() in /in/d7URn on line 14 Notice: Undefined variable: key in /in/d7URn on line 15 Warning: Missing argument 3 for {closure}() in /in/d7URn on line 14 Notice: Undefined variable: key in /in/d7URn on line 15
Output for hhvm-3.10.0 - 3.12.0
Warning: __invoke() expects exactly 3 parameters, 2 given in /in/d7URn on line 15 Warning: __invoke() expects exactly 3 parameters, 2 given in /in/d7URn on line 15 Warning: __invoke() expects exactly 3 parameters, 2 given in /in/d7URn on line 15 Warning: __invoke() expects exactly 3 parameters, 2 given in /in/d7URn on line 15
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/d7URn on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/d7URn on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/d7URn on line 12
Process exited with code 255.