note 84391 added to language.operators.comparison
| From: | irobeth at gmail dot com | Date: | Fri, 11 Jul 2008 21:53:18 +0000 |
| Subject: | note 84391 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141410@lists.php.net to get a copy of this message | ||
An interesting note about the behavior of the ternary operator:
$sql = "not equals";
echo 'if' . ($sql === "equals") ? $sql .= " sql equals " : $sql =
" sql doesn't equal";
will produce $sql = "not equals sql equals"
I don't know why but my guess is the ternary executes both result and then returns whichever is
true, and that it does so on a stack.
----
Server IP: 209.41.74.194
Probable Submitter: 209.33.170.2
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/84391
Del: integrated -- https://master.php.net/note/delete/84391/integrated
Del: useless -- https://master.php.net/note/delete/84391/useless
Del: bad code -- https://master.php.net/note/delete/84391/bad+code
Del: spam -- https://master.php.net/note/delete/84391/spam
Del: non-english -- https://master.php.net/note/delete/84391/non-english
Del: in docs -- https://master.php.net/note/delete/84391/in+docs
Del: other reasons-- https://master.php.net/note/delete/84391
Reject -- https://master.php.net/note/reject/84391
Search -- https://master.php.net/manage/user-notes.php