Io uso seguito da qualche parte nel mio codice:operatore ternario con ampersand
if (isset($flat[$pid])) {
$branch = &$flat[$pid]['items'];
} else {
$branch = &$tree;
}
Tutto ok, ma quando voglio brevemente per:
$branch = isset($flat[$pid]) ? &$flat[$pid]['items'] : &$tree;
ottengo:
errore di sintassi, imprevisto '&' ...
Cosa sto facendo male?
http://stackoverflow.com/questions/3389928/can-you-pass-by-reference-while-using-the-ternary-operator – Mihai