$arr = ['test' => ['gg' => ['tt' => []], 'hh' => ['ii' => []]]];
function get(array $array, ...$params) {
$result = $array;
foreach ($params as $param) {
$result = $result[$param] ?? null;
}
return $result;
}
var_dump(get($arr, 'test', 'gg', 'tt'));
var_dump(get($arr, 'test', 'gg'));
var_dump(get($arr, 'test', 'hh'));
array(
'title' => 'Name',
'link' => 'link',
'children' => array(
array(
'title' => 'Name',
'link' => 'link',
'children' => array()
),
array(
'title' => 'Name',
'link' => 'link',
'children' => array()
)
)
)