Php-Arrays function-array_intersect_assoc-intersection of Arrays computed with index check _ PHP Tutorial

Source: Internet
Author: User
Php-Arrays function-array_intersect_assoc-returns the intersection of Arrays computed by checking indexes. Array_intersect_assoc () includes the intersection of index check and calculation arrays [function] This function returns an array that contains all the array_intersect_assoc () values in the array1 array but not in any other parameter array () array intersection with index check

[Function] This function returns an array,
This array contains all values in the array of array1 but not in any other parameter.
Note that, unlike the array_intersect () function, the key name is also used for comparison.
Scope of use]
Php4> = 4.3.0, php5.
[Use]
Array array_intersect_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]
// 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_intersect_assoc ($ array1, $ array2 ));
/*
Array
(
[Blue] => 6
)
*/


Taken from zuodefeng's note

Http://www.bkjia.com/PHPjc/478207.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478207.htmlTechArticlearray_intersect_assoc () with index check calculates the intersection of arrays [function] This function returns an array that contains all the parameters 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.