PHP - Function array_uintersect_uassoc()
Syntax
array_uintersect_assoc( $array1, $array2 [, $array3 ..., $func1], $func2 );
Definition and Usage
This function returns an array containing all the values of array1 that are present in all the arguments array2, array3.
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
array1(Required) It specifies an array. |
| 2 |
array2(Required) It specifies an array to be compared with the first array. |
| 3 |
array3(Optional) It specifies an array to be compared with the first array. |
| 4 |
func1(Required) The name of the user-made function that compares the array keys. |
| 5 |
func2(Required) The name of the user-made function that compares the array values. |
Example
Try out following example −
<?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"));
?>
This will produce the following result −
Array ( [a] => green [b] => brown )
php_function_reference.htm
Advertisements