1--TEST--
2Test arsort() function : usage variations - sort strings
3--FILE--
4<?php
5
6$array = [
7    "lemoN" => "lemoN",
8    "Orange" => "Orange",
9    "banana" => "banana",
10    "apple" => "apple",
11    "Test" => "Test",
12    "TTTT" => "TTTT",
13    "ttt" => "ttt",
14    "ww" => "ww",
15    "x" => "x",
16    "X" => "X",
17    "oraNGe" => "oraNGe",
18    "BANANA" => "BANANA",
19];
20
21echo "Default flag\n";
22$temp_array = $array;
23var_dump(arsort($temp_array)); // expecting : bool(true)
24var_dump($temp_array);
25
26echo "SORT_REGULAR\n";
27$temp_array = $array;
28var_dump(arsort($temp_array, SORT_REGULAR)); // expecting : bool(true)
29var_dump($temp_array);
30
31echo "SORT_STRING\n";
32$temp_array = $array;
33var_dump(arsort($temp_array, SORT_STRING)); // expecting : bool(true)
34var_dump($temp_array);
35
36?>
37--EXPECT--
38Default flag
39bool(true)
40array(12) {
41  ["x"]=>
42  string(1) "x"
43  ["ww"]=>
44  string(2) "ww"
45  ["ttt"]=>
46  string(3) "ttt"
47  ["oraNGe"]=>
48  string(6) "oraNGe"
49  ["lemoN"]=>
50  string(5) "lemoN"
51  ["banana"]=>
52  string(6) "banana"
53  ["apple"]=>
54  string(5) "apple"
55  ["X"]=>
56  string(1) "X"
57  ["Test"]=>
58  string(4) "Test"
59  ["TTTT"]=>
60  string(4) "TTTT"
61  ["Orange"]=>
62  string(6) "Orange"
63  ["BANANA"]=>
64  string(6) "BANANA"
65}
66SORT_REGULAR
67bool(true)
68array(12) {
69  ["x"]=>
70  string(1) "x"
71  ["ww"]=>
72  string(2) "ww"
73  ["ttt"]=>
74  string(3) "ttt"
75  ["oraNGe"]=>
76  string(6) "oraNGe"
77  ["lemoN"]=>
78  string(5) "lemoN"
79  ["banana"]=>
80  string(6) "banana"
81  ["apple"]=>
82  string(5) "apple"
83  ["X"]=>
84  string(1) "X"
85  ["Test"]=>
86  string(4) "Test"
87  ["TTTT"]=>
88  string(4) "TTTT"
89  ["Orange"]=>
90  string(6) "Orange"
91  ["BANANA"]=>
92  string(6) "BANANA"
93}
94SORT_STRING
95bool(true)
96array(12) {
97  ["x"]=>
98  string(1) "x"
99  ["ww"]=>
100  string(2) "ww"
101  ["ttt"]=>
102  string(3) "ttt"
103  ["oraNGe"]=>
104  string(6) "oraNGe"
105  ["lemoN"]=>
106  string(5) "lemoN"
107  ["banana"]=>
108  string(6) "banana"
109  ["apple"]=>
110  string(5) "apple"
111  ["X"]=>
112  string(1) "X"
113  ["Test"]=>
114  string(4) "Test"
115  ["TTTT"]=>
116  string(4) "TTTT"
117  ["Orange"]=>
118  string(6) "Orange"
119  ["BANANA"]=>
120  string(6) "BANANA"
121}
122