0

Is there any php function that can return occurrences of all provided arrays (that are in all arrays)?

Example:

$array1 = array(1, 2, 3);
$array2 = array(1, 2, 4, 5, 6);
$array3 = array(1, 2, 3, 4, 5);

func_i_am_looking_for($array1, $array2, $array3);
//retrun array(1, 2);
1

1 Answer 1

3

Just try with array_intersect

$result = array_intersect($array1, $array2, $array3);
Sign up to request clarification or add additional context in comments.

1 Comment

Yes that's it, thank you! Didn't know how to name what I need. Will flag as correct answer in 10 minutes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.