note 104622 added to language.operators.comparison

From: Date: Sun, 26 Jun 2011 21:36:54 +0000
Subject: note 104622 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-180971@lists.php.net to get a copy of this message
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, '') ---- Server IP: 69.147.83.197 Probable Submitter: 81.71.91.33 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/104622 Del: integrated -- https://master.php.net/note/delete/104622/integrated Del: useless -- https://master.php.net/note/delete/104622/useless Del: bad code -- https://master.php.net/note/delete/104622/bad+code Del: spam -- https://master.php.net/note/delete/104622/spam Del: non-english -- https://master.php.net/note/delete/104622/non-english Del: in docs -- https://master.php.net/note/delete/104622/in+docs Del: other reasons-- https://master.php.net/note/delete/104622 Reject -- https://master.php.net/note/reject/104622 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180971) next »