[PHP-DEV] PHP 4.0 Bug #7958: array_diff does not perform as stated in the description From: slliid <email protected>
Date: 11/24/00

From: slliid <email protected>
Operating system: Win NT 4.0
PHP version: 4.0.3pl1
PHP Bug Type: Unknown/Other Function
Bug description: array_diff does not perform as stated in the description

<?php

 $array1[0] = "first";
 $array1[1] = "second";
 $array1[2] = "third";
 $array1[3] = "fourth";

 $array2[0] = "second";
 $array2[1] = "fourth";

 $diff = array_diff ($array1, $array2);

 for ($a = 0; $diff[$a]; $a++){
  print $diff[$a] . "<br>\n";
 }

 // This script should have printed "first" and "third" if the function was working fine, but instead it only printed "first".
 // Seems like the comparison stops once a match has been found.
 // It therefore is unable to list out all the differences.

?>

-- 
Edit Bug report at: http://bugs.php.net/?id=7958&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>