ID:               25164
 Updated by:       [EMAIL PROTECTED]
 Reported By:      linuxfool at hotmail dot com
-Status:           Verified
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: *
-PHP Version:      4.3.3RC5-dev, 5.0.0b2-dev
+PHP Version:      4.3.2
 New Comment:

Actually this is bogus. From manual:

"array_diff() returns an array containing all the values of 
array1  that are not present in any of the other arguments."

In your example, 30 is present in the $array2.



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

[2003-08-24 11:03:13] [EMAIL PROTECTED]

Simpler script:

<?php

$array1 = array (2,2);
$array2 = array (1,2);
print_r($array1);
print_r($array2);

print_r(array_diff($array1,$array2));
?>

Output:

Array
(
    [0] => 2
    [1] => 2
)
Array
(
    [0] => 1
    [1] => 2
)
Array
(
)


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

[2003-08-20 02:06:37] linuxfool at hotmail dot com

Description:
------------
See Code.

Thanks for your time.

Reproduce code:
---------------
echo "<pre>";
echo "RUNNING PHP VER 4.2.2 ON RH 9\n";

$array1 = array
(1=>9,2=>10,3=>5,4=>54,5=>30,6=>1,7=>22,8=>22,9=>111,10=>110,11=>30);
$array2 = array
(1=>9,2=>10,3=>5,4=>54,5=>30,6=>1,7=>22,8=>22,9=>111,10=>110,11=>112);
print_r($array1);
print_r($array2);

print_r(array_diff($array1,$array2));

echo "If the last value in array1 (30) is changed to anything other
then 30(that i am aware of) array_diff  works right.\nHave I been
smoking too much crack again?\n";


echo "</pre>";
?>


Expected result:
----------------
RUNNING PHP VER 4.2.2 ON RH 9
Array
(
    [1] => 9
    [2] => 10
    [3] => 5
    [4] => 54
    [5] => 30
    [6] => 1
    [7] => 22
    [8] => 22
    [9] => 111
    [10] => 110
    [11] => 30
)
Array
(
    [1] => 9
    [2] => 10
    [3] => 5
    [4] => 54
    [5] => 30
    [6] => 1
    [7] => 22
    [8] => 22
    [9] => 111
    [10] => 110
    [11] => 112
)
Array
(
[11] => 30
)
If the last value in array1 (30) is changed to anything other then
30(that i am aware of) it works right.
Have I been smoking too much crack again?



Actual result:
--------------
RUNNING PHP VER 4.2.2 ON RH 9
Array
(
    [1] => 9
    [2] => 10
    [3] => 5
    [4] => 54
    [5] => 30
    [6] => 1
    [7] => 22
    [8] => 22
    [9] => 111
    [10] => 110
    [11] => 30
)
Array
(
    [1] => 9
    [2] => 10
    [3] => 5
    [4] => 54
    [5] => 30
    [6] => 1
    [7] => 22
    [8] => 22
    [9] => 111
    [10] => 110
    [11] => 112
)
Array
(
)
If the last value in array1 (30) is changed to anything other then
30(that i am aware of) it works right.
Have I been smoking too much crack again?




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


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

Reply via email to