<?php
$array = [
[
'code' => '001',
'name' => 'Prostite',
'whpr' => [
'wh_price_rest' => [
['price' => 255, 'wrh' => 1],
['price'=> 900, 'wrh' => 5]
]
]
],
[
'code' => '002',
'name' => 'Menya',
'whpr' => [
'wh_price_rest' => [
['price' => 34535, 'wrh' => 42],
['price'=> 5445, 'wrh' => 2432]
]
]
],
];
$result = [];
foreach ($array as $item) {
foreach ($item['whpr']['wh_price_rest'] as $key => $value) {
unset($item['whpr']);
foreach ($value as $k => $v) $item[$k] = $v;
$result[] = $item;
}
}
print_r($result);
preferences:
28.25 ms | 402 KiB | 5 Q