[
['id'=>1],
['id'=>2],
['id'=>3]
]
[
'data' => [
'items' => [
'cars' => [
['id'=>1],
['id'=>2],
['id'=>3]
]
]
]
]
funciton to_nice_array($key, $items) {
$key_parts = explode('.', $key);
$key_parts = array_reverse($key_parts);
$result = $items;
foreach ($key_parts as $key_part) {
$result = array($key_part => $result);
}
return $result;
}