note 27688 deleted from language.operators by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:04:16 +0000 |
| Subject: | note 27688 deleted from language.operators by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58362@lists.php.net to get a copy of this message | ||
Note Submitter: eric@themepark.com
----
note that the ternary operator comes BEFORE the "." (string concatenate) operator... so
$a = 'eric is a '.(1) ? 'goofball' : 'kitty-cat';
echo $a;
this snippet returns "goofball" instead of "eric is a goofball".
$a = 'eric is a '.((1) ? 'goofball' : 'kitty-cat');
echo $a;
This snippet returns "eric is a goofball".
this little oversight bit me on the metaphorical ass :-) so hopefully this'll help others...