Getting unique values from 2 arrays

前端 未结 7 1970
借酒劲吻你
借酒劲吻你 2020-12-03 11:01

I have 2 arrays that I\'m trying to get the unique values only from them. So I\'m not just trying to remove duplicates, I\'m actually trying to remove both duplicates.

7条回答
  •  心在旅途
    2020-12-03 11:43

    Not to detract from Daniel Vandersluis's answer, but to add to it...

    What you're looking for is basically an XOR operation of the arrays. To that end, "merlinyoda at dorproject dot net" provided the following routine, in a comment on http://php.net/manual/en/function.array-diff.php :

    
    

    This function takes a different approach to calculating the XOR.

提交回复
热议问题