note 57165 added to language.control-structures
| From: | terry at mackintoshweb dot com | Date: | Sun, 25 Sep 2005 23:52:49 +0000 |
| Subject: | note 57165 added to language.control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95775@lists.php.net to get a copy of this message | ||
When using the ?: syntax:
echo "Something " . <condition> ? "true" : "false";
The above works, but not the below:
<condition> ? echo "Something ture" : echo "Something false";
which causes a syntax error.
It seems that ?: can return a static value but can not execute a command?
Granted the above example is contrived.
----
Manual Page -- http://www.php.net/manual/en/language.control-structures.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57165
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57165&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57165&report=yes
Search -- http://master.php.net/manage/user-notes.php