Funções PHP |
. Glossários Funções PHP - array_diff_assoc ( ) |
(PHP 4 >= 4.3.0, PHP 5)
array_diff_assoc -- Computes the
difference of arrays with additional index check
Description
array array_diff_assoc ( array array1, array
array2 [, array ...])
array_diff_assoc() returns an array containing all the values from array1 that are not present in any of the other arguments. Note that the keys are used in the comparison unlike array_diff().
Exemplo:
<?php
$array1 = array("a" => "green", "b"
=> "brown", "c" => "blue",
"red");
$array2 = array("a" => "green", "yellow",
"red");
$result = array_diff_assoc($array1, $array2);
print_r($result);
?>
O resultado é:
Array
(
[b] => brown
[c] => blue
[0] => red
)