PHP array_udiff_uassoc() Function

From http://www.w3schools.com (Copyright Refsnes Data)

# PHP array_udiff_uassoc() Function

Complete PHP Array Reference

## Definition and Usage

The array_udiff_uassoc() function compares two or more arrays, in two user-made functions, and returns an array containing the elements from the first array, if the user-made functions allow it. The first user-made function compares array keys, and the second compares array values, and both returns a numeric value, a positive number (1) if the returned array should contain this element, and 0, or a negative number (-1), if not.

## Syntax

    array_udiff_uassoc(array1,array2,array3...,function1,function2)

Parameter | Description
--- | ---
array1 | Required. The first array is the array that the others will be compared with
array2 | Required. An array to be compared with the first array
array3 | Optional. An array to be compared with the first array
function1 | Required. The name of the user-made function that compares the array keys
function2 | Required. The name of the user-made function that compares the array values

## Tips and Notes

Tip: You can compare the first array with one array, or as many as you like.

Note: For comparison, the key is used in the first function and the value is used in the second. They are both user-made functions.

## Example

    <?php
    function myfunction_key($v1,$v2)
    {
    if ($v1===$v2)
    	{
    	return 0;
    	}
    return 1;
    }

    function myfunction_value($v1,$v2)
    {
    if ($v1===$v2)
    	{
    	return 0;
    	}
    return 1;
    }
    $a1=array("a"=>"Cat","b"=>"Dog","c"=>"Horse");
    $a2=array("a"=>"Cat","b"=>"Dog","c"=>"Fish");
    print_r(array_udiff_uassoc($a1,$a2,"myfunction_key","myfunction_value"));
    ?>

The output of the code above will be:

    Array ( [c] => Horse )

Complete PHP Array Reference

From http://www.w3schools.com (Copyright Refsnes Data)