DobotJr
DobotJr

Reputation: 4049

Find whats the same in two arrays

I have two arrays:

1)

Array ( 
    [0] => 162 
    [1] => 163 
    [2] => 98 
    [3] => 13
)

2)

Array (
    [0] => 22
    [1] => 45
    [2] => 163
    [3] => 80
)

I want to find which values are the same in the these two arrays:

So that $thesame = 163 in this example

Thanks.

Upvotes: 0

Views: 63

Answers (1)

CD001
CD001

Reputation: 8472

Try array_intersect() ...

https://www.php.net/manual/en/function.array-intersect.php

Upvotes: 4

Related Questions