|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-20 02:06 UTC] 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?
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 13:00:02 2025 UTC |
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 ( )