


php-Arrays function-array_intersect_assoc-calculates the intersection of arrays with index check_PHP tutorial
Jul 13, 2016 pm 05:51 PM
array_intersect_assoc() calculates the intersection of arrays with index checking
【Function】This function will return an array,
This array contains all values in array1 that are not in any other parameter array.
Note that unlike the array_intersect() function, key names are also used for comparison.
【Scope of use】
php4>=4.3.0, php5.
【Use】
array array_intersect_assoc( array array1, array array2[,array...] )
array1/required/array1
array2/required/comparable array must have at least one
array.../optional/array used for comparison
【Example】
[php]
<?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
)
*/
Excerpted from zuodefeng’s notes

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Complete collection of excel function formulas

PHP array key value flipping: Comparative performance analysis of different methods

PHP array multi-dimensional sorting practice: from simple to complex scenarios

The Art of PHP Array Deep Copy: Using Different Methods to Achieve a Perfect Copy

Application of PHP array grouping function in data sorting

Best Practices for Deep Copying PHP Arrays: Discover Efficient Methods

C++ Function Exception Advanced: Customized Error Handling

The role of PHP array grouping function in finding duplicate elements
