array array_diff(array input_array1, array input_array2 [, array...])

The function array_diff() returns those values located in input_array1 that are not located in any of the other input arrays. This function is essentially the opposite of array_intersect(). An example follows:

$array1 = array("OH","CA","NY","HI","CT"); $array2 = array("OH","CA","HI","NY","IA"); $array3 = array("TX","MD","NE","OH","HI"); $diff = array_diff($array1, $array2, $array3); print_r($intersection);

This returns:

Was this article helpful?

+1 0

Post a comment