Although you noted your if-statement question, this is not an if statement, it is a triple conditional expression. I redid it accordingly.
Now the reason it doesn't work is because assignment by reference is different from assigning expressions of normal value in PHP. You cannot use links with the ?: Operator ?: just like you cannot do return &$foo; in function. For more information, see the PHP links manual pages in these pages:
If you use the if statement, it will work:
if ($a) $foo = &$a; else $foo = 'whatever';
But why would you like to use links like this outside of me (if it is not PHP 4, and even then you should no longer use PHP 4).
source share