note 97839 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Tue, 11 May 2010 17:47:10 +0000 |
| Subject: | note 97839 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169150@lists.php.net to get a copy of this message | ||
Note Submitter: __blackhole__ at n0fx dot net
----
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
?>