1--TEST-- 2Test array_change_key_case() function : usage variations - Different strings as keys 3--FILE-- 4<?php 5/* 6 * Test how array_change_key_case() behaves with different strings 7 */ 8 9echo "*** Testing array_change_key_case() : usage variations ***\n"; 10 11$inputs = array ( 12 // group of escape sequences 13 array(null => 1, NULL => 2, "\a" => 3, "\cx" => 4, "\e" => 5, "\f" => 6, "\n" => 7, "\t" => 8, "\xhh" => 9, "\ddd" => 10, "\v" => 11), 14 15 // array contains combination of capital/small letters 16 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) 17); 18 19foreach($inputs as $input) { 20 echo "\n-- \$case = default --\n"; 21 var_dump(array_change_key_case($input)); 22 echo "-- \$case = upper --\n"; 23 var_dump(array_change_key_case($input, CASE_UPPER)); 24} 25 26echo "Done"; 27?> 28--EXPECT-- 29*** Testing array_change_key_case() : usage variations *** 30 31-- $case = default -- 32array(10) { 33 [""]=> 34 int(2) 35 ["\a"]=> 36 int(3) 37 ["\cx"]=> 38 int(4) 39 [""]=> 40 int(5) 41 [""]=> 42 int(6) 43 [" 44"]=> 45 int(7) 46 [" "]=> 47 int(8) 48 ["\xhh"]=> 49 int(9) 50 ["\ddd"]=> 51 int(10) 52 [""]=> 53 int(11) 54} 55-- $case = upper -- 56array(10) { 57 [""]=> 58 int(2) 59 ["\A"]=> 60 int(3) 61 ["\CX"]=> 62 int(4) 63 [""]=> 64 int(5) 65 [""]=> 66 int(6) 67 [" 68"]=> 69 int(7) 70 [" "]=> 71 int(8) 72 ["\XHH"]=> 73 int(9) 74 ["\DDD"]=> 75 int(10) 76 [""]=> 77 int(11) 78} 79 80-- $case = default -- 81array(9) { 82 ["lemon"]=> 83 int(1) 84 ["orange"]=> 85 int(11) 86 ["banana"]=> 87 int(12) 88 ["apple"]=> 89 int(4) 90 ["test"]=> 91 int(5) 92 ["tttt"]=> 93 int(6) 94 ["ttt"]=> 95 int(7) 96 ["ww"]=> 97 int(8) 98 ["x"]=> 99 int(10) 100} 101-- $case = upper -- 102array(9) { 103 ["LEMON"]=> 104 int(1) 105 ["ORANGE"]=> 106 int(11) 107 ["BANANA"]=> 108 int(12) 109 ["APPLE"]=> 110 int(4) 111 ["TEST"]=> 112 int(5) 113 ["TTTT"]=> 114 int(6) 115 ["TTT"]=> 116 int(7) 117 ["WW"]=> 118 int(8) 119 ["X"]=> 120 int(10) 121} 122Done 123