vp_*_*rth 4 php syntax ternary-operator pass-by-reference
我在我的代码中使用了以下内容:
if (isset($flat[$pid])) {
$branch = &$flat[$pid]['items'];
} else {
$branch = &$tree;
}
Run Code Online (Sandbox Code Playgroud)
一切都好,但是当我想把它缩短为:
$branch = isset($flat[$pid]) ? &$flat[$pid]['items'] : &$tree;
Run Code Online (Sandbox Code Playgroud)
我明白了:
语法错误,意外'&'...
我做错了什么?