检查jQuery元素之间的重复项

Does anybody know how to check for duplicate entries in a queries, where query elements are separated by comma.

Eg.

$query1 = email1,email2,email3; 

$query2 = email1,email2,email2;

$query3 = email4,email5,email6; 

$query4 = email7,email7,email8; 

I need to check if there are any duplicates between each $query element? Eg. If in $query1 I found email1, then in $query2 the same variable would be indicated as a duplicate and so on in all the queries.

Thank you!

Use

  • for separating by comma explode(',',$query) to get an array of entries
  • then test the arrays against each other with in_array($keyFromAnotherArray,$array)

that should lead to the solution