$users = [
[
"name" => "Илья",
"surname" => "Блинов",
"organization" => [
"name" => "фейсбук",
"region" => [
"id" => 62,
"name" => "Рязанская область",
],
],
],
];
$users = [
[
"name" => "Илья",
"surname" => "Блинов",
"organizationName" => 'фейсбук',
"regionName" => 'Рязанская область',
"regionId" => 62,
],
];
foreach ($users as $k => $user) {
foreach ($user as $v => $value) {
if (is_array($value)) {
}
}
}
array_map(function ($user) {
$organization = $user['organization'];
$region = $organization['region'];
return [
"name" => $user['name'],
"surname" => $user['surname'],
"organizationName" => $organization['name'],
"regionName" => $region['name'],
"regionId" => $region['id'],
];
}, $users)
Array
(
[0] => Array
(
[name] => Илья
[surname] => Блинов
[organizationName] => фейсбук
[regionName] => Рязанская область
[regionId] => 62
)
)