- print_r: documentation ( source)
<?php
$tree = [
10 => [],
11 => [
4 => [],
5 => [],
6 => []
]
];
$path = array(11,5,0);
$inseration = array('A','B');
$current = &$tree;
foreach($path as $key){
$current = &$current[$key];
}
$current = $inseration;
print_r($tree);