Php-Arrays function-array_diff_assoc-difference value of array calculation with index check _ PHP Tutorial

Source: Internet
Author: User
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.