#39811 [Csd->Bgs]: array_diff "compare with 2" bug
| From: | tony2001@php.net | Date: | Wed, 13 Dec 2006 11:32:32 +0000 |
| Subject: | #39811 [Csd->Bgs]: array_diff "compare with 2" bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106301@lists.php.net to get a copy of this message | ||
ID: 39811
Updated by: tony2001@php.net
Reported By: wishm at bk dot ru
-Status: Closed
+Status: Bogus
Bug Type: Arrays related
Operating System: win32
PHP Version: 4.4.4
New Comment:
.
Previous Comments:
------------------------------------------------------------------------
[2006-12-13 11:29:18] wishm at bk dot ru
ok the problem was just at this function's "feature" - multiple
occurrences in first array are all treated the same way. I was wondered
that applies to the associative arrays, too. So indexes are simply
ignored. Screwed up a bit... array_diff_assoc fixes that :) Sorry for
the bothering.
------------------------------------------------------------------------
[2006-12-13 11:29:15] tony2001@php.net
There is even Russian translation of this particular page:
http://ru.php.net/manual/ru/function.array-diff.php
------------------------------------------------------------------------
[2006-12-13 11:27:09] tony2001@php.net
>I think you dont understand the purpose of the array_diff() function.
And I think you didn't read what I said and keep ignoring the docs.
>The element is considered present if and only if its'
>VALUE is equal to the same-named element's VALUE in the
>second array!
No. Read the documentation first.
http://php.net/array_diff
------------------------------------------------------------------------
[2006-12-13 11:10:14] wishm at bk dot ru
I think you dont understand the purpose of the array_diff() function.
The element is considered present if and only if its' VALUE is equal to
the same-named element's VALUE in the second array! Try
array_diff(array("a"=>"1"),array("a"=>"2")). The
element a = 1 does not
present at second array so it will be returned. You didnt even tried to
understand the essence of the bug! It is 100% PHP error when 2 is
considered equal to ANY value under conditions I've described. Please
fix that!
------------------------------------------------------------------------
[2006-12-13 10:06:39] tony2001@php.net
http://php.net/array_diff
array_diff() returns an array containing **all the values of array1
that are not present in any of the other arguments*.
In your case all values of $a are present in $b.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39811
--
Edit this bug report at http://bugs.php.net/?id=39811&edit=1