PHP array_intersect() Function

The array_intersect() function is used to compare two or more arrays and returns an array containing all the values of the first array that are present in other arrays. In this operation, keys are preserved

Example -

It returns an array in flip order, i.e. keys from input become values and values from input become keys.

Example -