php man page for array_diff_key

Query: array_diff_key

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

ARRAY_DIFF_KEY(3)							 1							 ARRAY_DIFF_KEY(3)

array_diff_key - Computes the difference of arrays using keys for comparison

SYNOPSIS
array array_diff_key (array $array1, array $array2, [array $...])
DESCRIPTION
Compares the keys from $array1 against the keys from $array2 and returns the difference. This function is like array_diff(3) except the comparison is done on the keys instead of the values.
PARAMETERS
o $array1 - The array to compare from o $array2 - An array to compare against o $... - More arrays to compare against
RETURN VALUES
Returns an array containing all the entries from $array1 whose keys are not present in any of the other arrays.
EXAMPLES
Example #1 array_diff_key(3) example The two keys from the key => value pairs are considered equal only if (string) $key1 === (string) $key2 . In other words a strict type check is executed so the string representation must be the same. <?php $array1 = array('blue' => 1, 'red' => 2, 'green' => 3, 'purple' => 4); $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8); var_dump(array_diff_key($array1, $array2)); ?> The above example will output: array(2) { ["red"]=> int(2) ["purple"]=> int(4) }
NOTES
Note This function only checks one dimension of a n-dimensional array. Of course you can check deeper dimensions by using array_diff_key($array1[0], $array2[0]);.
SEE ALSO
array_diff(3), array_udiff(3), array_diff_assoc(3), array_diff_uassoc(3), array_udiff_assoc(3), array_udiff_uassoc(3), array_diff_ukey(3), array_intersect(3), array_intersect_assoc(3), array_intersect_uassoc(3), array_intersect_key(3), array_intersect_ukey(3). PHP Documentation Group ARRAY_DIFF_KEY(3)
Related Man Pages
array_replace(3) - php
array_diff_key(3) - php
array_intersect_key(3) - php
array_udiff(3) - php
array_udiff_uassoc(3) - php
Similar Topics in the Unix Linux Community
if loop not working in BASH shell
Using Bash scripting to compare arrays looking for matches
Invert Matrix of Data - Perl
Compare two arrays by values [BASH]
Calling an array of arrays in C.