PHP array_diff_key() FunctionLast Updated : 17 Mar 2025 This is an inbuilt function of PHP. This function was introduced in PHP 5.1. The array_diff_key() function compares the keys of two or more arrays, and returns entries from array1 that are not present in array2 or array3, etc. Syntax
Return TypeReturns an array containing the entries from array1 that are not present in any of the other arrays. Example 1Output: Array ( [3]=> Boi ) Example 2Output: Array( [20] => Laxman [30] => Rahul [40] => Ganguly [50] => Yuvi ) Example 3Output: Array ( [b] => Bed ) Example 4Output: Array ( [a1]=> red [c3]=> blue [d4]=> black ) Next TopicPhp-array-diff-uassoc-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