|
array_intersect_key() returns an array containing all the values of array1 which have matching keys that are present in all the arguments.
In our example you see that only the keys 'blue' and 'green' are present in both arrays and thus returned. Also notice that the values for the keys 'blue' and 'green' differ between the two arrays. A match still occurs because only the keys are checked. The values returned are those of array1.
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.
See also array_diff(), array_udiff() array_diff_assoc(), array_diff_uassoc(), array_udiff_assoc(), array_udiff_uassoc(), array_diff_key(), array_diff_ukey(), array_intersect(), array_intersect_assoc(), array_intersect_uassoc() and array_intersect_ukey().
Poprzedni | Spis treści | Następny |
array_intersect_assoc | Początek rozdziału | array_intersect_uassoc |
Hosting by: Hurra Communications Sp. z o.o.
Generated: 2007-01-26 18:02:41