To return the unique elements (those with a key that exists only once in either array but not in both) try:function array_unique_diff ($array1, $array2){ array_merge(array_diff_key($array1, $array2), array_diff_key($array2, $array1));}

I needed something a little different where maybe even the keys in multidimensional arrays don't match up. Setting $assoc to false will cause only to check for missing keys, otherwise it compares values as well. This was also based on '2ge at 2ge dot us' function