note 99970 added to language.operators.comparison
| From: | levchuk at atmatic dot com | Date: | Fri, 17 Sep 2010 13:16:05 +0000 |
| Subject: | note 99970 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172672@lists.php.net to get a copy of this message | ||
> mail at markuszeller dot com
> 04-Aug-2010 08:40
> I prefer writing (!$a == 'hello') much more than ($a != 'hello'),
> but I wondered about the performance.
That is wrong, (!$a == 'hello') will evaluate as ((!$a) == 'hello'), not (!($a
== 'hello'))
Example:
$a = 'est';
echo ($a!='test') ? 'true ' : 'false ';
$a = 'est';
echo (!$a=='test') ? 'true' : 'false';
Out: true false
That's why it runs faster :) - it's not the same comparision
----
Server IP: 69.147.83.197
Probable Submitter: 93.125.39.190
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/99970
Del: integrated -- https://master.php.net/note/delete/99970/integrated
Del: useless -- https://master.php.net/note/delete/99970/useless
Del: bad code -- https://master.php.net/note/delete/99970/bad+code
Del: spam -- https://master.php.net/note/delete/99970/spam
Del: non-english -- https://master.php.net/note/delete/99970/non-english
Del: in docs -- https://master.php.net/note/delete/99970/in+docs
Del: other reasons-- https://master.php.net/note/delete/99970
Reject -- https://master.php.net/note/reject/99970
Search -- https://master.php.net/manage/user-notes.php