@ 2014-02-24T15:56:22Z <?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);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 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(14): array_reduce(Array, Object(Closure))
#2 [internal function]: {closure}(Array)
#3 /in/d7URn(13): array_map(Object(Closure), Array)
#4 [internal function]: {closure}(Array)
#5 /in/d7URn(12): array_map(Object(Closure), Array)
#6 {main}
thrown in /in/d7URn on line 14
Process exited with code 255 . Output for 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 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.3.29 , 5.4.0 - 5.4.45 , 5.5.24 - 5.5.35 , 5.6.7 - 5.6.28 , 7.0.0 - 7.0.20 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 4.4.2 - 4.4.9 , 5.1.0 - 5.1.6 , 5.2.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.3.11 , 4.4.0 - 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 . preferences:dark mode live preview
233.84 ms | 401 KiB | 354 Q