- print_r: documentation ( source)
- array_pop: documentation ( source)
<?php
$array = [
['other'],
[['other'], ['value']]
];
$keys = [1, 1];
$result = &$array;
$last = array_pop($keys);
foreach ($keys as $key) {
$result = &$result[$key];
}
unset($result[$last]);
print_r($array);