PHP array_diff() function
The array_diff() function compares two or more arrays and returns an array with the keys and values from the first array, only if the value is not present in any of the other arrays. This function was introduced in PHP 4.0.
It returns an array containing the entries from array1 that are not present in any of the other arrays.
Important note- Only the value is used in comparison
Array (  => netbeans )
Array (  => zend )
Array (  => c  => d  => e )
Array (  => yellow )
Difference between array_diff( ) , array_diff_key( ) and array_diff_assoc( )
Array( [fruit1] => apple ) Array ( [friut3] => mango ) Array ( [fruit1] => apple [friut3] => mango )
On using array_diff, the value that exists in $array1, and not exists in another array, is returned as the resultant array. Similarly, the other PHP array difference functions return the different element of the array.
Next TopicPHP Array Functions