Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有 2 个数组,如下所示:
array1 = (2, 3, 4); array2 = (1, 2, 3, 4, 5);
我想获取第二个数组的值,其中array1的值在array2中没有找到,所以我们可以得出以下是array3
array3 = (1, 5);
区分数组
$array3 = array_diff($array2, $array1);
$array3 = array_diff($array1, $array2);