1--TEST--
2Test array_diff() function : usage variations - array containing duplicate keys and values
3--FILE--
4<?php
5/*
6 * Test that array_diff behaves as expected for comparing:
7 * 1. the order of the array
8 * 2. duplicate values
9 * 3. duplicate key names
10 */
11
12echo "*** Testing array_diff() : usage variations ***\n";
13
14$array_index = array('a', 'b', 'c', 0 => 'd', 'b');   //duplicate key (0), duplicate value (b)
15$array_assoc = array ('2' => 'c',   //same key=>value pair, different order
16                      '1' => 'b',
17                      '0' => 'a',
18                      'b' => '3',   //key and value from array_index swapped
19                      'c' => 2);    //same as above, using integer
20
21var_dump(array_diff($array_index, $array_assoc));
22var_dump(array_diff($array_assoc, $array_index));
23
24echo "Done";
25?>
26--EXPECT--
27*** Testing array_diff() : usage variations ***
28array(1) {
29  [0]=>
30  string(1) "d"
31}
32array(3) {
33  [0]=>
34  string(1) "a"
35  ["b"]=>
36  string(1) "3"
37  ["c"]=>
38  int(2)
39}
40Done
41