note 26308 deleted from language.operators.comparison by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:17:27 +0000 |
| Subject: | note 26308 deleted from language.operators.comparison by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58438@lists.php.net to get a copy of this message | ||
Note Submitter: bishop (now on: simulated - icon of coi)
----
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