There are two arrays $first = ['one','two','three'];$second= ['five','four','three']; The question is how to make a check for the same elements, something like

 if(in_array($first,$second)){ echo 'yes'} else {echo 'no'} 

    1 answer 1

    Array intersection: array_intersect

     $intersection = array_intersect(['one', 'two', 'three'], ['five', 'four', 'three']); // ['three'] 

    After that, it remains to use the aforementioned in_array to search for elements at the intersection:

     if (in_array('three', $intersection)) ...