Bug #18315: Different behaviour of array_diff in a variables and encapsuled with each
| From: | cirello at estadao dot com dot br | Date: | Fri, 12 Jul 2002 14:39:59 +0000 |
| Subject: | Bug #18315: Different behaviour of array_diff in a variables and encapsuled with each | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13985@lists.php.net to get a copy of this message | ||
From: cirello@estadao.com.br
Operating system: Linux Red Hat Linux release 7.1
PHP version: 4.2.1
PHP Bug Type: Arrays related
Bug description: Different behaviour of array_diff in a variables and encapsuled with each
/* Two arrays do diff */
$array_one = Array(1,2,3);
$array_two = Array(1,2);
/* Bugged behaviour*/
while( list(,$value) = @each(array_diff($array_one, $array_two)) )
echo $value."\n";
/* But this while loop never ends ... If the array_diff returns just one
value , why is it never ending?*/
/* WorkAround */
$array_diffed = array_diff($array_one, $array_two);
while( list(,$value) = @each($array_diffed) )
echo $value."\n";
--
Edit bug report at http://bugs.php.net/?id=18315&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18315&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18315&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18315&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18315&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18315&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18315&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18315&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18315&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18315&r=globals