``$output = $output[$root]`` would be more efficient as it does not need to intersect the whole array just to keep 1 element for a known key.