note 104622 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Mon, 27 Jun 2011 14:32:07 +0000 |
| Subject: | note 104622 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-180993@lists.php.net to get a copy of this message | ||
Note Submitter: michiel ed thalent nl
----
In response to: mail at markuszeller dot com 04-Aug-2010 08:40
You are doing two completely different comparisons. In fact, in your example one will yield TRUE and
the other FALSE.
This is what you are doing:
var_dump(!1 == 'hello'); // false
var_dump(1 != 'hello'); // true
!$var, is the same as $var == false, so then the comparison will become:
($var == false) == 'hello'
Since 'hello' == true, above statement will only be true if $var == false (null, 0, false,
'')