When i found these two functions existed i almost backflipped! anyway...
but i don't quite understand something about them...
looking at the php manual example:
<?php
$array1 = array("a" => "green", "red", "blue", "red");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);
print_r($result);
//this will print:
//Array
//(
// [1] => blue
//)
//
?>
What about yellow? I don't understand why this wouldn't print a difference there also?
the array_intersect() fucntion example (i won't repeat it here) picks up the common parts and excludes all the uncommom.... duh!
but why doesn't array_diff() pick up all the uncommon? would re-arranging
$result = array_diff($array1, $array2);
//to
$result = array_diff($array2, $array1);
actually only print [1] => yellow ??
so if you wanted to find all the differnces you would have to then concantenate the the result like this?
$result_1_to_2 = array_diff($array1, $array2);
$result_2_to_1 = array_diff($array2, $array1);
$all_differences = $result_1_to_2 . $result_2_to_1;
or is there a typo in the php manual... ?
Just want some clarification if you could.
Thank-you,
Phence