note 97839 added to language.operators.comparison
| From: | __blackhole__ at n0fx dot net | Date: | Tue, 11 May 2010 16:26:26 +0000 |
| Subject: | note 97839 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-169147@lists.php.net to get a copy of this message | ||
The following comment was a bit misguiding.
http://www.php.net/manual/en/language.operators.comparison.php#95997
The true nature of the ternary operator is more something like that:
<?php
echo 0 ? '0 is true' : '0 is false'; //0 is false
echo 1 ? '1 is true' : '1 is false'; //1 is true
echo null ? 'null is true' : 'null is false'; //null is false
echo true ? 'true is true' : 'true is false'; //1 is true
echo 42 ? 'Answer to the Ultimate Question of Life, the Universe, and Everything' :
'Random gibbrish'; //1 is true
?>
----
Server IP: 69.147.83.197
Probable Submitter: 195.65.73.4
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/97839
Del: integrated -- https://master.php.net/note/delete/97839/integrated
Del: useless -- https://master.php.net/note/delete/97839/useless
Del: bad code -- https://master.php.net/note/delete/97839/bad+code
Del: spam -- https://master.php.net/note/delete/97839/spam
Del: non-english -- https://master.php.net/note/delete/97839/non-english
Del: in docs -- https://master.php.net/note/delete/97839/in+docs
Del: other reasons-- https://master.php.net/note/delete/97839
Reject -- https://master.php.net/note/reject/97839
Search -- https://master.php.net/manage/user-notes.php