Intersect unknown number of arrays in PHP

后端 未结 5 464
猫巷女王i
猫巷女王i 2021-01-11 09:30

I\'m trying to intersect an arbitrary number of PHP arrays, the count of which depends on a user provided parameter, each of which can have any number of elements.

F

5条回答
  •  醉话见心
    2021-01-11 10:11

    I am posting my answer very very late, but just want to share a small piece of code that helps me ,in case somebody needs it for this question.

    print_r(array_intersect(array_merge($array1,$array2,...),$intersectionArr);
    

    I hope this helps

    Thanks

提交回复
热议问题