Php-Arrays function-array_diff_assoc-with the index check to calculate the difference value of the array. The array_diff_assoc () function carries the index check to calculate the difference set of the array [function] This function returns an array that contains all arrays in array1 but not in any other parameter array array_diff_assoc () function with index check calculate the difference set of the array
[Function]
This function returns an array,
This array contains all values in the array of array1 but not in any other parameter.
Scope of use]
> = 4.3.0 and php5
[Use]
Array array_diff_assoc (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]
$ Arr1 = array ("key1" => "val1", "key2" => "val2 ");
$ Arr2 = array ("key1" => "val1", "key3" => "val2 ");
$ Arr3 = array ("key2" => "val2 ");
Print_r (array_diff_assoc ($ arr1, $ arr2 ));
Print_r (array_diff_assoc ($ arr1, $ arr3 ));
Print_r (array_diff_assoc ($ arr1, $ arr2, $ arr3 ));
/*
Array
(
[Key2] => val2
)
Array
(
[Key1] => val1
)
Array
(
)
*/
Taken from zuodefeng's note
Http://www.bkjia.com/PHPjc/478199.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478199.htmlTechArticlearray_diff_assoc () function with index check calculate the array's difference set [function] This function returns an array that contains all arrays in array1 but not in any other parameter array...