Если примитивно и не вникать в детали:
<?php
$arr = ['Массив' =>
[
'purchases' => 'Покупки',
'food' => 'Еда',
'vegetables' => 'Овощи',
'carrot' => 'Морковка',
]
];
$newArr = [];
$prevUri = "";
foreach ( $arr['Массив'] as $key => $name ) {
$uri = $prevUri ? "{$prevUri}/{$key}" : $key;
$newArr['Массив'][$key] = [
'name' => $name,
'uri' => $uri,
];
$prevUri = $uri;
}
print_r($newArr);
Результат:
Array
(
[Массив] => Array
(
[purchases] => Array
(
[name] => Покупки
[uri] => purchases
)
[food] => Array
(
[name] => Еда
[uri] => purchases/food
)
[vegetables] => Array
(
[name] => Овощи
[uri] => purchases/food/vegetables
)
[carrot] => Array
(
[name] => Морковка
[uri] => purchases/food/vegetables/carrot
)
)
)