Easy Tutorial
❮ Php Pdo Transactions Func Misc Usleep ❯

PHP array_intersect_assoc() Function

Complete PHP Array Reference Manual

Example

Compare the keys and values of two arrays and return the intersection:


Definition and Usage

The array_intersect_assoc() function is used to compare the keys and values of two (or more) arrays and return the intersection.

This function compares the keys and values of two (or more) arrays and returns an intersection array, which includes all keys and values present in the compared array (array1) that are also present in any of the other parameter arrays (array2 or array3, etc.).


Syntax

Parameter Description
array1 Required. The first array to compare with other arrays.
array2 Required. An array to compare against the first array.
array3,... Optional. Additional arrays to compare against the first array.

Technical Details

Return Value: Returns an intersection array, which includes all keys and values present in the compared array (array1) that are also present in any of the other parameter arrays (array2 or array3, etc.).
PHP Version: 4.3.0+
--- ---

More Examples

Example 1

Compare the keys and values of three arrays and return the intersection:


❮ Php Pdo Transactions Func Misc Usleep ❯