显示文本框

array_intersect_uassoc()

« array_intersect_key | array_intersect_ukey »
<?php
// custom callback function
function compare_func($a$b) {
    if (
$a === $b) return 0;
    if (
$a $b)   return 1;
    return -
1;
};

$array array_intersect_uassoc (
    
// array $array1
    
// array $array2
    
?  // callable $key_compare_func
);
?>
结果
$array = [
  
'b' => 'brown',
]
示例
#1 array_intersect_uassoc  (["a" => "green""b" => "brown""c" => "blue"=> "red"],
 [
"a" => "GREEN""B" => "brown"=> "yellow"=> "red"],
 
"strcasecmp")
#2 array_intersect_uassoc  (["a" => "green""b" => "brown""c" => "blue"=> "red"],
 [
"a" => "green"=> "yellow"=> "red"],
 
"compare_func")
#3 array_intersect_uassoc  (["a" => 1"b" => 2"c" => 3],
 [
"a" => 2"c" => "3"],
 
"strcmp")
另请参阅
array_diff_uassoc, array_intersect, array_intersect_assoc, array_intersect_key, array_intersect_ukey, array_uintersect_assoc, array_uintersect_uassoc, call_user_func