..
Array_diff_assoc function compares two or more arrays and returns a new array with the keys and values of the first array that are not found in any other arrays used in the comparison.
The function in question admits a minimum of two parameters:
$ A1 = array (0 => "Cat", 1 => "Dog", 2 => "Rat"); $ A2 = array (0 => "Chicken", 1 => "Rat", 2 => "Dog"); $ A3 = array (0 => "Rat", 1 => "Dog", 2 => "Cat"); print_r (array_diff_assoc ($ a1, $ a2, $ a3));The output of the code above will be:
Array ( [0] => Cat [2] => Rat )The second array, as you can see, has no key / value pair in common with the first and the third array, however, the pair shares 1 => "Dog".
| |
Linux (Course)
Complete guide to open-source system. From 49 €. |
| |
MySQL (Course)
Management of open-source database. From 39 €. |
| |
PHP (Course)
Full course for creating dynamic Web sites. From 49 €. |