<?php
$array = [
[1, 30, 33],
['id' => 5]
];
$result = array_reduce($array, function (array $result, array $array) {
return array_merge($result, array_map(function ($id) { return compact('id'); }, $array);
}, []);
var_dump($result);
- Output for 5.4.0 - 5.4.29
- Parse error: syntax error, unexpected ';' in /in/bAON8 on line 9
Process exited with code 255. - Output for 5.3.0 - 5.3.28
- Parse error: syntax error, unexpected '[' in /in/bAON8 on line 3
Process exited with code 255.
preferences:
174.29 ms | 1395 KiB | 66 Q