Opposite of array_intersect?

前端 未结 5 1104
盖世英雄少女心
盖世英雄少女心 2021-02-06 20:36

Is there a built-in function to get all members of array 1 which do not exist in array 2?
I know how to do it programatically, only wondering if there is a built-in function

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-06 21:16

    That sounds like a job for array_diff.

    Returns an array containing all the entries from array1 that are not present in any of the other arrays.

提交回复
热议问题