php array_diff_assoc() function


  Translation results:

diff

English ['dɪf] American ['dɪf]

abbr.differential differential (of); difference different; differ different; differentiator differentiator

assoc

English ['əsɒk] American ['əsɒk]

abbr.associate make happen contact; unite; associated; association alliance


php array_diff_assoc() functionsyntax

Use: Used to compare the key names and key values ​​of two (or more) arrays and return the difference.

Description: This function compares the key names and key values ​​​​of two (or more) arrays, and returns a difference array, which includes everything in the compared array (array1), but Key names and values ​​that are not in any other parameter array (array2 or array3, etc.).

Syntax: array_diff_assoc(array1,array2,array3...);

Parameters:

< td width="301" valign="top" style="word-break: break-all;">Required, the first array to be compared with other arrays< /tr>
ParametersDescription
array1
array2
Required, the array to be compared with the first array
array3Optional, array to compare with the first array

php array_diff_assoc() functionexample

"red","b"=>"green","c"=>"blue","d"=>"yellow");
$a2=array("a"=>"red","b"=>"green","c"=>"blue");

$result=array_diff_assoc($a1,$a2);
print_r($result);
?>

Run instance»

Click the "Run instance" button to view Online examples

Home

Videos

Q&A