note 92115 deleted from function.array-diff by danbrown
| From: | danbrown@php.net | Date: | Thu, 09 Jul 2009 14:00:34 +0000 |
| Subject: | note 92115 deleted from function.array-diff by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158103@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
I want to correct a small mistake in the example above:
<?php
$array1 = array("a" => "green", "red", "blue",
"red");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);
print_r($result);
?>
in this case the $result would equal to Array('green', 'blue');
<?php
$array1 = array("a" => "green", "red", "blue",
"yellow");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);
print_r($result);
?>
$result is Array("blue");
I assume the example meant the second case.