$menu[$value]['children'][$value_2]['opened'] = true
$menu[$value]['children'][$value_2]['children'][$value_3]['opened'] = true
$menu[$value]['children'][$value_2]['children'][$value_3]['children'][$value_4]['opened'] = true
$path = array(
[0]=> 1
[1]=> 1.1
[2]=> 1.1.1
[3]=> 1.1.1.1
);
$menu [$value]['opened'] = true
$menu[$value]['children'][$value_2]['opened'] = true
$menu[$value]['children'][$value_2]['children'][$value_3]['opened'] = true
$menu[$value]['children'][$value_2]['children'][$value_3]['children'][$value_4]['opened'] = true
if( is_array($path) ) {
$c = 'opened';
foreach ($path as $key => $value) {
$key == 0 ? $menu [$value][$c] = true : false;
}
}
if( is_array($path) ) {
$a = $menu;
$b = ['children'];
$c = ['opened'];
foreach ($path as $key => $value) {
$a . [$key] . $c = true;
}
}