PHP array_intersect() FunctionLast Updated : 17 Mar 2025 The array_intersect( ) function is used to Computes the intersection of arrays. It compares 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. This function was introduced in PHP 4.0.1. SyntaxParameter
Return TypeIt returns an array containing the entries from array1 that are present in all of the other arrays. EXAMPLE 1Output: Array ( [a] => java [0] => python ) EXAMPLE 2Output: Array ( [a] => chess ) EXAMPLE 3Output: Array ( [Orange] => 100 [Apple] => 200 [Banana] => 300 ) EXAMPLE 4Output: Array ( [2] => rishi [3] => ayush ) Next TopicPhp-array-intersect-key-function |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India