Bug #73427 [Fbk->NoF]: Unintended behaviour of intersection functions
| From: | php-bugs at lists dot php dot net | Date: | Sun, 24 Jun 2018 04:25:28 +0000 |
| Subject: | Bug #73427 [Fbk->NoF]: Unintended behaviour of intersection functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215909@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73427&edit=1
ID: 73427
Updated by: php-bugs@lists.php.net
Reported by: turabgarip at gmail dot com
Summary: Unintended behaviour of intersection functions
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Arrays related
Operating System: Windows
PHP Version: 5.6.27
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2018-05-21 06:46:02] requinix@php.net
I don't see the "compare from the first three colors" behavior. Where/how are you
seeing that?
And I assume this also applies to PHP 7.1 and 7.2?
------------------------------------------------------------------------
[2018-05-21 06:24:56] turabgarip at gmail dot com
Wow, it's been years and no one actually took a glance on it? :)
------------------------------------------------------------------------
[2016-10-31 08:14:30] turabgarip at gmail dot com
Description:
------------
Intersection functions intend to compute the intersection of two or more arrays; but they try to
compare the elements of the individual array itself. This is contradictory to the logic of
intersection. Thus it makes the intersection functions considerably slow.
In the test script, there are two arrays. Intersection will start to compare from the first three
colors like; "blue" to "green", "black" to "blue"; that are,
the elements of the first array only; which are actually very unnecessary to compare. Because the
actual intention is to compute the intersection of the two arrays; not the intersection of the
elements of the array itself. However an array can contain only one identical element at once
anyway, so it's useless and resource consuming to check the array's own elements against
each other.
Test script:
---------------
$arr1 = array('green', 'blue', 'black');
$arr2 = array('yellow', 'red', 'cyan');
array_intersect($arr1, $arr2);
Expected result:
----------------
Intersection function should compare the elements of the given arrays crosswise.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73427&edit=1