note 32645 deleted from language.operators.comparison by pollita
| From: | pollita@php.net | Date: | Tue, 03 Jun 2003 19:51:18 +0000 |
| Subject: | note 32645 deleted from language.operators.comparison by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49654@lists.php.net to get a copy of this message | ||
Note Submitter:
----
re: bishop's note above, comparison of arrays
$i = 7;
array ($i) == array($i++)
this will return true, as $i++ is the post-increment operator, which returns the value of $i before
incrementing it. It is equivalent to:
array(7) == array(7)
whereas
array($i) == array(++$i)
is like
array(7) == array(8)
it's good practise to only use ++ and -- on their own line, with no other code, to avoid
confusion about post- and pre-*crements