English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The array_uintersect_uassoc() function calculates the intersection of arrays with index checking, using separate callback functions to compare data and indexes
array_uintersect_assoc( $array1, $array2 [, $array3 ..., $func1], $func2 );
This function returns an array containing1The array of all values of2、array3Through additional index checks, callback function comparisons, and index comparisons, it returns the intersection of multiple arrays.
Serial Number | Parameters and Description |
---|---|
1 | array1(Required) It specifies an array. |
2 | array2(Required) It specifies the array to be compared with the first array. |
3 | array3(Optional) It specifies the array to be compared with the first array. |
4 | func1(Required) The name of the user-defined function used to compare array keys. |
5 | func2(Required) The name of the user-defined function used to compare array values. |
array_uintersect_uassoc uses two strcasecmp functions to compare the keys and values of two arrays, calculating the intersection of two arrays
<?php $input1 = array("a"=>"green", "b"=>"brown", "c"=>"blue", "red"); $input2 = array("a"=>"GREEN", "B"=>"brown", "yellow", "red"); print_r(array_uintersect_uassoc($input1, $input2, "strcasecmp", "strcasecmp")); ?>Test and see‹/›
Output result:
Array ( [a] => green [b] => brown )