note 99970 deleted from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Fri, 17 Sep 2010 14:34:10 +0000 |
| Subject: | note 99970 deleted from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172685@lists.php.net to get a copy of this message | ||
Note Submitter: levchuk at atmatic dot com
----
> 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