array(4) {
[0]=>
int(13)
[1]=>
string(12) "header_items"
[2]=>
int(1)
[3]=>
int(108)
}
$arr[13]["header_items"][1][108]['value'] = 'some_value';
$t = &$arr;
foreach ($keys as $key) {
if (!isset($t[$key]) || !is_array($t[$key])) {
$t[$key] = [];
}
$t = &$t[$key];
}
$t['value'] = $val;
foreach ($keys as $key) {
$element = $element[$key] ?? $arr[$key];
}
echo $element['value']