2 /* Prototype : array array_diff(array $arr1, array $arr2 [, array ...])
3 * Description: Returns the entries of $arr1 that have values which are not
4 * present in any of the others arguments.
5 * Source code: ext/standard/array.c
9 * Test that array_diff behaves as expected for comparing:
10 * 1. the order of the array
12 * 3. duplicate key names
14 <<__EntryPoint
>> function main(): void
{
15 echo "*** Testing array_diff() : usage variations ***\n";
17 $array_index = array('a', 'b', 'c', 0 => 'd', 'b'); //duplicate key (0), duplicate value (b)
18 $array_assoc = array ('2' => 'c', //same key=>value pair, different order
21 'b' => '3', //key and value from array_index swapped
22 'c' => 2); //same as above, using integer
24 var_dump(array_diff($array_index, $array_assoc));
25 var_dump(array_diff($array_assoc, $array_index));