Created
February 4, 2015 21:00
-
-
Save aradnom/556ad5c89e1e82dfe2ef to your computer and use it in GitHub Desktop.
Performs a true array intersection (array_uintersect will keep items in a1 even if they are not present in a2, a3, etc.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$combined = array_filter($array1, function ($a) use ($array2) { | |
$found = array_filter($array2, function ($b) use ($a) { | |
return ((int) $a->ID) === ((int) $b->ID); | |
}); | |
return !empty($found); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment