ID: 22863 Updated by: [EMAIL PROTECTED] Reported By: pieter3d at hotmail dot com -Status: Verified +Status: Bogus Bug Type: Arrays related Operating System: WinXP PHP Version: 4.3.1 New Comment:
Oh well the code is bogus, actually the array returned is more like this: array(6) { [0]=> int(1) [1]=> int(2) [5]=> int(6) [6]=> int(7) [7]=> int(8) [8]=> int(9) } According to: <?php $a = array(1,2,3,4,5,6,7,8,9); $b = array(3,4,5); $test=array_diff($a,$b); $i=0; var_dump($test); ?> Keys are preserved! While just stop on your scripts because key 2 isn't defined. Don't use while for this. Not a bug, read the documentation -> Bogus. Previous Comments: ------------------------------------------------------------------------ [2003-03-24 19:04:56] [EMAIL PROTECTED] Verified with PHP-4.3.2RC1 (UNIX and Windows NT). ------------------------------------------------------------------------ [2003-03-24 18:59:41] pieter3d at hotmail dot com When executing this code: $a = array(1,2,3,4,5,6,7,8,9); $b = array(3,4,5); $test=array_diff($a,$b); $i=0; while($test[$i]) { echo "$test[$i]<br>"; $i++; } the result is: 1 2 The expected result of course is 1 2 6 7 8 9 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22863&edit=1