..


Sponsored Links

array_diff_key

Array_diff_key function compares two or more arrays and returns an array with the elements of the first array whose keys are not present in any other array comparison.

The accepted parameters are:

  • array1 (Required)
    The first array is the one with which all others will be compared;
  • array2 (Required)
    An array to be compared with the first;
  • array3 (Optional)
    More arrays to be compared with the first array.
Warning: the comparison is considered not only the key values!
Example:





 $ A1 = array (0 => "Cat", 1 => "Dog", 2 => "Rat");







 $ A2 = array (2 => "Bird", 3 => "Chicken", 4 => "Fish");







 $ A3 = array (5 => "Rat", 6 => "Dog", 7 => "Bird");







 print_r (array_diff_key ($ a1, $ a2, $ a3));



The output of the code above will be:
 



 Array (



  



 [0] => Cat



  



 [1] => Dog







 )

 

In the same category ...
E-Learning
Linux (Course) Linux (Course)
Complete guide to open-source system. From 49 €.
MySQL (Course) MySQL (Course)
Management of open-source database. From 39 €.
PHP (Course) PHP (Course)
Full course for creating dynamic Web sites. From 49 €.
Sponsored Links