ion
ion

Reputation: 1059

Arrays in php, Compare 2 arrays and keep duplicate values

The following is 2 different definitions of the problem:

How can I process 2 arrays so that I can keep the data of duplicate array[key] values.

I have arrays A and B. I want to create array C with the children that their id/key values exist in both A and B arrays.

Thank you

Upvotes: 3

Views: 6229

Answers (1)

user187291
user187291

Reputation: 53940

array_intersect_assoc seems to be what you're looking for

Upvotes: 8

Related Questions