Home Menu

array_intersect_assoc

Computes the intersection of arrays with additional index check

Syntax

array_intersect_assoc ( array $array1 , array $array2 [, array $... ] ) : array

Parameters

array1

The array with master values to check.

array2

An array to compare values against.

...

A variable list of arrays to compare.

Return

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

Examples

array1 array2

<?

$array1 = array("a" => 0, "b" => 1, "c" => 2, "d" => 3);
$array2 = array("a" => 0, "b" => 4, "e" => 2, "f" => 5);

$return = array_intersect_assoc($array1, $array2);

print_r($return);

?>
Array
(
    [1] => 123478564142
)
> 5);

$return = array_intersect_assoc($array1, $array2);

print_r($return);

?>

...

<?

$array1 = array("a" => 0, "b" => 1, "c" => 2, "d" => 3);
$array2 = array("a" => 0, "b" => 4, "e" => 2, "f" => 5);
$array3 = array("a" => 0, "b" => 4, "e" => 2, "f" => 5);

$return = array_intersect_assoc($array1, $array2, $array3);

print_r($return);

?>
Array
(
    [a] => 0
)

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms