note 32645 added to language.operators.comparison
| From: | php-general at lists dot php dot net | Date: | Tue, 03 Jun 2003 18:37:38 +0000 |
| Subject: | note 32645 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49646@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32645
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32645&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32645&report=yes