开发者

Remove values found in both arrays

开发者 https://www.devze.com 2023-01-26 10:16 出处:网络
What I\'m looking to do is compare two arrays and remove values that are found in both arrays. such that:

What I'm looking to do is compare two arrays and remove values that are found in both arrays.

such that:

Array1
(
    [0] =&开发者_如何学Cgt; 12356
    [1] => 34567
    [2] => 67890
)

Array2
(
    [0] => 12356
    [1] => 66666
    [2] => 22222
)

And the result that I need is

Array3
    (
        [0] => 12356
    )

Wondering if there's a quick way to do this before I build some function to handle it.


$result = array_intersect($arr1, $arr2);
0

精彩评论

暂无评论...
验证码 换一张
取 消