It will work as an alternative,
(isset($flat[$pid])) ? ($branch = &$flat[$pid]['items']) : ($branch = &$tree);
Edit:
The shortest thing that can pass is two lines,
@$temp = &$flat[$pid]['items']; $branch = &${isset($flat[$pid]) ? "temp" : "tree"};
Viral source share