Created
February 8, 2017 16:27
-
-
Save ccapndave/7b5ba62b333d22eb4f1dd174a89f04d5 to your computer and use it in GitHub Desktop.
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
// A very ugly PHP way of removing duplicates from an array with regard to strict equality | |
$users = (function(...$arrays) { | |
$uniqueElements = []; | |
foreach ($arrays as $array) { | |
foreach ($array as $element) { | |
$uniqueElements[spl_object_hash($element)] = $element; | |
} | |
} | |
return array_values($uniqueElements); | |
})($array1, $array2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment