#24829 [NEW]: array_intersect_assoc compares keys AND values
| From: | niklas at zim dot goe dot net | Date: | Sun, 27 Jul 2003 13:34:40 +0000 |
| Subject: | #24829 [NEW]: array_intersect_assoc compares keys AND values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-44826@lists.php.net to get a copy of this message | ||
From: niklas at zim dot goe dot net
Operating system: Linux 2.4.20
PHP version: 4.3.1
PHP Bug Type: Arrays related
Bug description: array_intersect_assoc compares keys AND values
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 bug report at http://bugs.php.net/?id=24829&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=24829&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=24829&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=24829&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24829&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24829&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24829&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24829&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24829&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24829&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24829&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24829&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24829&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24829&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24829&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24829&r=gnused