1--TEST--
2Test array_change_key_case() function : usage variations - Different strings as keys
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6  die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
7}
8--FILE--
9<?php
10/* Prototype  : array array_change_key_case(array $input [, int $case])
11 * Description: Retuns an array with all string keys lowercased [or uppercased]
12 * Source code: ext/standard/array.c
13 */
14
15/*
16 * Test how array_change_key_case() behaves with different strings
17 */
18
19echo "*** Testing array_change_key_case() : usage variations ***\n";
20
21$inputs = array (
22	// group of escape sequences
23	array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11),
24
25	// array contains combination of capital/small letters
26	array("lemoN" => 1, "Orange" => 2, "banana" => 3, "apple" => 4, "Test" => 5, "TTTT" => 6, "ttt" => 7, "ww" => 8, "x" => 9, "X" => 10, "oraNGe" => 11, "BANANA" => 12)
27);
28
29foreach($inputs as $input) {
30	echo "\n-- \$case = default --\n";
31	var_dump(array_change_key_case($input));
32	echo "-- \$case = upper --\n";
33	var_dump(array_change_key_case($input, CASE_UPPER));
34}
35
36echo "Done";
37?>
38--EXPECTF--
39*** Testing array_change_key_case() : usage variations ***
40
41-- $case = default --
42array(10) {
43  [""]=>
44  int(2)
45  ["\a"]=>
46  int(3)
47  ["\cx"]=>
48  int(4)
49  [""]=>
50  int(5)
51  [""]=>
52  int(6)
53  ["
54"]=>
55  int(7)
56  ["	"]=>
57  int(8)
58  ["\xhh"]=>
59  int(9)
60  ["\ddd"]=>
61  int(10)
62  [""]=>
63  int(11)
64}
65-- $case = upper --
66array(10) {
67  [""]=>
68  int(2)
69  ["\A"]=>
70  int(3)
71  ["\CX"]=>
72  int(4)
73  [""]=>
74  int(5)
75  [""]=>
76  int(6)
77  ["
78"]=>
79  int(7)
80  ["	"]=>
81  int(8)
82  ["\XHH"]=>
83  int(9)
84  ["\DDD"]=>
85  int(10)
86  [""]=>
87  int(11)
88}
89
90-- $case = default --
91array(9) {
92  ["lemon"]=>
93  int(1)
94  ["orange"]=>
95  int(11)
96  ["banana"]=>
97  int(12)
98  ["apple"]=>
99  int(4)
100  ["test"]=>
101  int(5)
102  ["tttt"]=>
103  int(6)
104  ["ttt"]=>
105  int(7)
106  ["ww"]=>
107  int(8)
108  ["x"]=>
109  int(10)
110}
111-- $case = upper --
112array(9) {
113  ["LEMON"]=>
114  int(1)
115  ["ORANGE"]=>
116  int(11)
117  ["BANANA"]=>
118  int(12)
119  ["APPLE"]=>
120  int(4)
121  ["TEST"]=>
122  int(5)
123  ["TTTT"]=>
124  int(6)
125  ["TTT"]=>
126  int(7)
127  ["WW"]=>
128  int(8)
129  ["X"]=>
130  int(10)
131}
132Done
133