Home > PHP > Function > Arrays > array_intersect_key()

array_intersect_key()

array_intersect_key - Computes the intersection of arrays using keys for comparison

Syntax

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

Arguments

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

Description

array_intersect_key() returns an array containing all the entries of array1 which have keys that are present in all the arguments.

Version

PHP 5.1.0

Return value

Returns an associative array containing all the entries of array1 which have keys that are present in all arguments.