#24829 [Opn->Bgs]: array_intersect_assoc compares keys AND values

From: Date: Sun, 27 Jul 2003 15:03:44 +0000
Subject: #24829 [Opn->Bgs]: array_intersect_assoc compares keys AND values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-44829@lists.php.net to get a copy of this message
 ID:               24829
 Updated by:       iliaa@php.net
 Reported By:      niklas at zim dot goe dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Linux 2.4.20
 PHP Version:      4.3.1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

The displayed behaviour is the correct one.


Previous Comments:
------------------------------------------------------------------------

[2003-07-27 08:34:40] niklas at zim dot goe dot net

Description:
------------
The function array_intersect_assoc compares keys AND values. According
to the documentation only the keys should be considered.

The documentation says:
"Note that the keys are used in the comparison unlike in
array_intersect()."

If this is the volitional behavior you should point that out in the
documentation ("... that the keys are used too ...").

Reproduce code:
---------------
$array1 = array ("a" => "green");
$array2 = array ("a" => "greenToo");
print_r(array_intersect_assoc ($array1, $array2));

Expected result:
----------------
Array(
  [a] => "green"
)

Actual result:
--------------
Array()



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=24829&edit=1



Thread (3 messages)

« previous php.bugs (#44829) next »