note 83568 added to control-structures.alternative-syntax
| From: | tmont at osu1 dot php dot net | Date: | Sun, 01 Jun 2008 22:17:56 +0000 |
| Subject: | note 83568 added to control-structures.alternative-syntax | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140058@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 68.8.202.84
----
Manual Page -- http://www.php.net/manual/en/control-structures.alternative-syntax.php
Edit -- https://master.php.net/note/edit/83568
Del: integrated -- https://master.php.net/note/delete/83568/integrated
Del: useless -- https://master.php.net/note/delete/83568/useless
Del: bad code -- https://master.php.net/note/delete/83568/bad+code
Del: spam -- https://master.php.net/note/delete/83568/spam
Del: non-english -- https://master.php.net/note/delete/83568/non-english
Del: in docs -- https://master.php.net/note/delete/83568/in+docs
Del: other reasons-- https://master.php.net/note/delete/83568
Reject -- https://master.php.net/note/reject/83568
Search -- https://master.php.net/manage/user-notes.php