note 26308 added to language.operators.comparison
| From: | (now on: simulated - icon of coi) | Date: | Fri, 25 Oct 2002 19:34:58 +0000 |
| Subject: | note 26308 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38566@lists.php.net to get a copy of this message | ||
The equality comparison operator works* for arrays, as well.
Arrays seem to be compared on an element by element basis, so that:
array (0,0) == array (0,0)
but
array (0,1) != array (1,1)
If you use strict equality, the types of the elements within the arrays must match as well.
So,
array (0,'0') == array (0,0) is TRUE
but
array (0,'0') === array (0,0) is FALSE
Finally, and as usual, do not necessarily expect PHP to compare elements left to right.
So, this may or may not work**:
$i = 7;
array ($i) == array($i++)
* tested only on PHP 4.2.1, did not check into source.
** it returned TRUE on PHP 4.2.1, Intel machine
--
http://www.php.net/manual/en/language.operators.comparison.php
http://master.php.net/manage/user-notes.php?action=edit+26308
http://master.php.net/manage/user-notes.php?action=delete+26308
http://master.php.net/manage/user-notes.php?action=reject+26308