|
array_diff_assocComputes the difference of arrays with additional index check Description
array array_diff_assoc
( array
$array1
, array $array2
[, array $...
] )
Compares Parameters
Return Values
Returns an array containing all the values from
Examples
Example #1 array_diff_assoc example In this example you see the "a" => "green" pair is present in both arrays and thus it is not in the output from the function. Unlike this, the pair 0 => "red" is in the output because in the second argument "red" has key which is 1.
<?phpThe above example will output:
Array
(
[b] => brown
[c] => blue
[0] => red
)
Example #2 array_diff_assoc example Two values from key => value pairs are considered equal only if (string) $elem1 === (string) $elem2 . In other words a strict check takes place so the string representations must be the same.
<?phpThe above example will output:
Array
(
[0] => 0
[1] => 1
)
Notes
See Also
|