From: subson at gmail dot com Operating system: Windows XP PHP version: 5.2.5 PHP Bug Type: Scripting Engine problem Bug description: php developer
Description: ------------ This is the existing code i Found in php.net manual, It has 3 parameters, what is the purpose of 3rd parameter. If it is going to check from 3rd array also any intersecting elements. I tried code below with 3 arrays but it displayed me empty array. Working Code from PHP manual: ******************************************************************* array array_diff ( array array1, array array2 [, array ...] ) array_diff() returns an array containing all the values of array1 that are not present in any of the other arguments. Note that keys are preserved. Example 1. array_diff() example <?php $array1 = array("a" => "green", "red", "blue", "red"); $array2 = array("b" => "green", "yellow", "red"); $result = array_diff($array1, $array2); print_r($result); ?> Multiple occurrences in $array1 are all treated the same way. This will output : Array ( [1] => blue ) ********************************************************************** ********************************************************************** Reproduce code: --------------- Code i Tried: ********************************************************************** <?php $array1 = array("a" => "green", "red", "blue","white"); $array2 = array("b" => "green", "yellow", "red"); //$array3 = array("white"); $array3 = array(); $result = array_intersect($array1, $array2,$array3); print_r($result); ?> // Output Array ( ) an empty Array ********************************************************************** Expected result: ---------------- it should check in the 3rd array also for any intersecting elements and then it should display the elements from array1 which are intersecting with either 2nd or 3rd array. Actual result: -------------- An empty Array -- Edit bug report at http://bugs.php.net/?id=43800&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43800&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43800&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43800&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43800&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43800&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43800&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43800&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43800&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43800&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43800&r=support Expected behavior: http://bugs.php.net/fix.php?id=43800&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43800&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43800&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43800&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43800&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43800&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43800&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43800&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43800&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43800&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43800&r=mysqlcfg