PHP 4.0 Bug #6002: array_diff / array_intersect returning wrong elements
| From: | hpdl at theexchangeproject dot org | Date: | Mon, 07 Aug 2000 10:25:58 +0000 |
| Subject: | PHP 4.0 Bug #6002: array_diff / array_intersect returning wrong elements | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-27997@lists.php.net to get a copy of this message | ||
From: hpdl@theexchangeproject.org
Operating system: FreeBSD 4.0
PHP version: 4.0.1pl2
PHP Bug Type: Misbehaving function
Bug description: array_diff / array_intersect returning wrong elements
array_diff was introduced in 4.0.1, but i cant get it to return the elements right.
$array1 = array ("page1", "page2", "page3", "page4");
$array2 = array ("page1", "page4");
$result = array_diff ($array1, $array2);
for ($i=0; $i < sizeof($result); $i++) {
echo $i . '-' . $result[$i] . '<br>' . "\n";
}
i am looking for a result of array('page2','page3') - but gives me
array('','page2')
array_intersect returns array('page1') with the above example.. is it not meant to return
array('page1','page4') ?