note 33787 deleted from language.operators.comparison by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:14:13 +0000 |
| Subject: | note 33787 deleted from language.operators.comparison by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58418@lists.php.net to get a copy of this message | ||
Note Submitter: matthew.somerville@trinity.oxford.ac.uk
----
dragon_rage4's code has a mistake: "if ($myVar == $myVar++)" will always evaluate to
true, so the second case will also print "They are equal".
And to avoid the "assignment in an if statement pit", one could reverse the comparison -
putting "if (5 == $myVar)" is fine, but "if (5 = $myVar)" will throw up an
error.