Doc #75444 [NEW]: Array comparison operators unprecise
| From: | kvanderheijden at transip dot nl | Date: | Thu, 26 Oct 2017 08:12:53 +0000 |
| Subject: | Doc #75444 [NEW]: Array comparison operators unprecise | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-15184@lists.php.net to get a copy of this message | ||
From: kvanderheijden at transip dot nl
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Array comparison operators unprecise
Description:
------------
On the PHP documentation page about array operators, the equality tests
operators are misleading. See:
http://us2.php.net/manual/en/language.operators.array.php
The docs say that the Identity comparison operator '===' checks the
order of the elements, whereas there is no such mention on the Equality
comparison operator.
This would imply that the order does not matter when comparing array's
with the Equality operator. This is incorrect.
Test script:
---------------
$a = [1, 2, 3];
$b = [1, 3, 2];
echo '$a == $b: ', ($a == $b ? 'TRUE' : 'FALSE'), PHP_EOL;
echo '$a === $b: ', ($a === $b ? 'TRUE' : 'FALSE'), PHP_EOL;
Expected result:
----------------
$a == $b: TRUE
$a === $b: FALSE
Actual result:
--------------
$a == $b: FALSE
$a === $b: FALSE
--
Edit bug report at https://bugs.php.net/bug.php?id=75444&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75444&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75444&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75444&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75444&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75444&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75444&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75444&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75444&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75444&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75444&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75444&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75444&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75444&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75444&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75444&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75444&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75444&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75444&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75444&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75444&r=mysqlcfg