Home > PHP > Function > Arrays > array_intersect_assoc()

array_intersect_assoc()

array_intersect_assoc - Computes the intersection of arrays with additional index check

Syntax

array array_intersect_assoc (array $array1, array $array2, array $ ...)

Arguments

  • array1 - The array with master values to check.
  • array2 - An array to compare values against.
  • ... - A variable list of arrays to compare.

Description

array_intersect_assoc() returns an array containing all the values of array1 that are present in all the arguments. Note that the keys are used in the comparison unlike in array_intersect().

Version

PHP 4.3.0, 5

Return value

Returns an associative array containing all the values in array1 that are present in all of the arguments.