Intersect unknown number of arrays in PHP

后端 未结 5 465
猫巷女王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:08

    $arrays = [
        $userArray1,
        $userArray2,
        $userArray3
    ];
    $result = array_intersect(...$arrays);
    

提交回复
热议问题