1--TEST--
2Test array_diff_assoc() function : basic functionality
3--FILE--
4<?php
5/*
6 * Test basic functionality of array_diff_assoc
7 */
8
9echo "*** Testing array_diff_assoc() : basic functionality ***\n";
10$array_default_key = array('one',       2,            'three', '4');
11$array_numeric_key = array(1 => 'one',  2=> 'two',    3 => 4);
12$array_string_key  = array('one' => 1, 'two' => '2', '3' => 'three');
13
14
15
16echo "-- Compare Default keys to numeric keys --\n";
17var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
18var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
19
20
21echo "\n-- Compare Default keys to string keys --\n";
22var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
23var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
24
25
26echo "\n-- Compare numeric keys to string keys --\n";
27var_dump(array_diff_assoc($array_numeric_key, $array_string_key));
28var_dump(array_diff_assoc($array_string_key, $array_numeric_key));
29
30
31echo "Done";
32?>
33--EXPECT--
34*** Testing array_diff_assoc() : basic functionality ***
35-- Compare Default keys to numeric keys --
36array(3) {
37  [0]=>
38  string(3) "one"
39  [1]=>
40  int(2)
41  [2]=>
42  string(5) "three"
43}
44array(2) {
45  [1]=>
46  string(3) "one"
47  [2]=>
48  string(3) "two"
49}
50
51-- Compare Default keys to string keys --
52array(3) {
53  [0]=>
54  string(3) "one"
55  [1]=>
56  int(2)
57  [2]=>
58  string(5) "three"
59}
60array(2) {
61  [1]=>
62  string(3) "one"
63  [2]=>
64  string(3) "two"
65}
66
67-- Compare numeric keys to string keys --
68array(3) {
69  [1]=>
70  string(3) "one"
71  [2]=>
72  string(3) "two"
73  [3]=>
74  int(4)
75}
76array(3) {
77  ["one"]=>
78  int(1)
79  ["two"]=>
80  string(1) "2"
81  [3]=>
82  string(5) "three"
83}
84Done
85