note 8176 added to array_diff
| From: | ks at ksweb dot de | Date: | Wed, 30 Aug 2000 08:44:31 +0000 |
| Subject: | note 8176 added to array_diff | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-3649@lists.php.net to get a copy of this message | ||
'preserved' means the keys are taken from the first accurence of the elements.
The example is wrong:
$array1 = array ("a" => "green", "red", "blue");
$array2 = array ("b" => "green", "yellow", "red");
$result = array_diff ($array1, $array2);
print_r($result);
$your_result=array("blue");
print_r($your_result);
outputs:
Array ( [1] => blue ) Array ( [0] => blue )
the correct Array-Statement of $result is:
$result=array("","blue");
http://www.php.net/manual/function.array-diff.php