We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Removing Duplicate Keys from Multiple Arrays

deharvy
deharvy asked
on
Medium Priority
664 Views
Last Modified: 2012-05-11
array_unique can be used to remove duplicate key value sets from an array.

How do I remove duplicate key values sets by comparing multiple arrays?
Comment
Watch Question

CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Most Valuable Expert 2011
Author of the Year 2014

Commented:
Give us some example inputs and expected outputs.  It matters whether the array keys are numeric or associative.
Most Valuable Expert 2011
Author of the Year 2014

Commented:
The exact definition of "remove" also matters.  Do you want to eliminate duplicates from all of the arrays?  Or do you want to keep only one copy in one of the arrays?  Do you want to test for duplicate keys, or duplicate values or duplicate key=>value pairs?  

Author

Commented:
Ray,

I only want to test for duplicate values. The key doesn't matter.

So, when I do a print_r, it should only display one key with a unique value.

Hope this is more clear.
Most Valuable Expert 2011
Author of the Year 2014

Commented:
Please give us some example inputs and expected outputs, thanks.  Like how many arrays are involved, and whether the keys are associative or numeric?  Thanks, ~Ray
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.