Definition
The array_diff_assoc() function compares the keys and values of two (or more) arrays, and return an array that contains the entries from array1 that are not present in array2 or array3, etc.
Syntax
array_diff_assoc(array1,array2,array3...)
Parameters
Parameter | Description |
---|---|
array1 |
Required. The array to compare from |
array2 |
Required. An array to compare against |
array3 |
Optional. More arrays to compare against |
Example
<?php
$ages1 = array("Mark" => 22, "Jeff" => 32, "Mike" => 28);
$ages2 = array("Mark" => 22,"Mike" => 28);
print_r(array_diff_assoc($ages1, $ages2));