note 83568 deleted from control-structures.alternative-syntax by mgf
| From: | mgf@php.net | Date: | Thu, 28 Aug 2008 12:48:21 +0000 |
| Subject: | note 83568 deleted from control-structures.alternative-syntax by mgf | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-143926@lists.php.net to get a copy of this message | ||
Note Submitter: tmont
----
In response to the note concerning references below, his point is taken, albeit in the wrong
context. According to the section on references
(http://www.php.net/manual/en/language.references.return.php), returning by reference means you
return a variable by reference, not an expression. The ternary operator is an expression, which is
why his example doesn't work (it also generates an E_NOTICE, "Only variable references
should be returned by reference...").
I mentioned the wrong context because the ternary operator has nothing to do with alternative syntax
(e.g. if: ... endif;); it is its own alternative to the alternative. As it were.
Word.