note 101406 added to language.operators.comparison

From: Date: Wed, 15 Dec 2010 08:19:05 +0000
Subject: note 101406 added to language.operators.comparison
Groups: php.notes 
Request: Send a blank email to php-notes+get-174934@lists.php.net to get a copy of this message
To mail at markuszeller dot com: (!$a == 'hello') and ($a != 'hello') are not equal. !$a evaluates to either true or false, depending on the content of $a, so in essence what the former is doing is checking if 'hello' is true or false, and not a string comparison as (I imagine) you intended. That should explain the huge difference in performance. ---- Server IP: 69.147.83.197 Probable Submitter: 83.145.242.13 ---- Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php Edit -- https://master.php.net/note/edit/101406 Del: integrated -- https://master.php.net/note/delete/101406/integrated Del: useless -- https://master.php.net/note/delete/101406/useless Del: bad code -- https://master.php.net/note/delete/101406/bad+code Del: spam -- https://master.php.net/note/delete/101406/spam Del: non-english -- https://master.php.net/note/delete/101406/non-english Del: in docs -- https://master.php.net/note/delete/101406/in+docs Del: other reasons-- https://master.php.net/note/delete/101406 Reject -- https://master.php.net/note/reject/101406 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174934) next »