1--TEST--
2Test arsort() function : usage variations - sort bool values
3--FILE--
4<?php
5/*
6 * testing arsort() by providing bool value array for $array argument with following flag values.
7 * flag value as default
8 * SORT_REGULAR - compare items normally
9*/
10
11echo "*** Testing arsort() : usage variations ***\n";
12
13// bool value array
14$bool_values = array (1 => true, 2 => false, 3 => TRUE, 4 => FALSE);
15
16echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is default --\n";
17$temp_array = $bool_values;
18var_dump(arsort($temp_array) );
19var_dump($temp_array);
20
21echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --\n";
22$temp_array = $bool_values;
23var_dump(arsort($temp_array, SORT_REGULAR) );
24var_dump($temp_array);
25
26echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC  --\n";
27$temp_array = $bool_values;
28var_dump(arsort($temp_array, SORT_NUMERIC) );
29var_dump($temp_array);
30
31echo "\n-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --\n";
32$temp_array = $bool_values;
33var_dump(arsort($temp_array, SORT_STRING) );
34var_dump($temp_array);
35
36echo "Done\n";
37?>
38--EXPECT--
39*** Testing arsort() : usage variations ***
40
41-- Testing arsort() by supplying bool value array, 'flag' value is default --
42bool(true)
43array(4) {
44  [1]=>
45  bool(true)
46  [3]=>
47  bool(true)
48  [2]=>
49  bool(false)
50  [4]=>
51  bool(false)
52}
53
54-- Testing arsort() by supplying bool value array, 'flag' value is SORT_REGULAR --
55bool(true)
56array(4) {
57  [1]=>
58  bool(true)
59  [3]=>
60  bool(true)
61  [2]=>
62  bool(false)
63  [4]=>
64  bool(false)
65}
66
67-- Testing arsort() by supplying bool value array, 'flag' value is SORT_NUMERIC  --
68bool(true)
69array(4) {
70  [1]=>
71  bool(true)
72  [3]=>
73  bool(true)
74  [2]=>
75  bool(false)
76  [4]=>
77  bool(false)
78}
79
80-- Testing arsort() by supplying bool value array, 'flag' value is SORT_STRING --
81bool(true)
82array(4) {
83  [1]=>
84  bool(true)
85  [3]=>
86  bool(true)
87  [2]=>
88  bool(false)
89  [4]=>
90  bool(false)
91}
92Done
93