Array_diff () function compute the difference set of an array [function] This function returns an array that contains all values in the array of array1 but not in any other parameter array. Note that the key name of the original array remains unchanged. [Scope of use] php4 & gt; 4.0.1, php5. [use]... SyntaxHighlighter.
Array_diff () function compute array difference set
[Function]
This function returns an array,
This array contains all values in the array of array1 but not in any other parameter.
Note that the key name of the original array remains unchanged.
Scope of use]
Php4> 4.0.1, php5.
[Use]
Array array_diff (array array1, array array2 [, array...])
Array1/required/array 1
Array2/required/compared arrays must have at least one
Array.../optional/array for comparison
[Example]
[Php]
// Define two arrays respectively
$ Array1 = array ("blue" => 6, "red" => 2, "green" => 3, "purple" => 4 );
$ Array2 = array ("green" => 5, "blue" => 6, "yellow" => 7, "cyan" => 8 );
Print_r (array_diff ($ array1, $ array2 ));
/*
Array
(
[Red] => 2
[Green] => 3
[Purple] => 4
)
*/
Taken from zuodefeng's note