1--TEST--
2Test rsort() function : usage variations - boolean values
3--FILE--
4<?php
5/* Prototype  : bool rsort(array &$array_arg [, int $sort_flags])
6 * Description: Sort an array in reverse order
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Pass rsort() arrays of boolean values to test behaviour
12 */
13
14echo "*** Testing rsort() : variation ***\n";
15
16// bool value array
17$bool_values = array (true, false, TRUE, FALSE);
18
19echo "\n-- 'flag' value is defualt --\n";
20$temp_array = $bool_values;
21var_dump(rsort($temp_array) );
22var_dump($temp_array);
23
24echo "\n-- 'flag' value is SORT_REGULAR --\n";
25$temp_array = $bool_values;
26var_dump(rsort($temp_array, SORT_REGULAR) );
27var_dump($temp_array);
28
29echo "\n-- 'flag' value is SORT_NUMERIC  --\n";
30$temp_array = $bool_values;
31var_dump(rsort($temp_array, SORT_NUMERIC) );
32var_dump($temp_array);
33
34echo "\n-- 'flag' value is SORT_STRING --\n";
35$temp_array = $bool_values;
36var_dump(rsort($temp_array, SORT_STRING) );
37var_dump($temp_array);
38
39echo "Done";
40?>
41
42--EXPECTF--
43*** Testing rsort() : variation ***
44
45-- 'flag' value is defualt --
46bool(true)
47array(4) {
48  [0]=>
49  bool(true)
50  [1]=>
51  bool(true)
52  [2]=>
53  bool(false)
54  [3]=>
55  bool(false)
56}
57
58-- 'flag' value is SORT_REGULAR --
59bool(true)
60array(4) {
61  [0]=>
62  bool(true)
63  [1]=>
64  bool(true)
65  [2]=>
66  bool(false)
67  [3]=>
68  bool(false)
69}
70
71-- 'flag' value is SORT_NUMERIC  --
72bool(true)
73array(4) {
74  [0]=>
75  bool(true)
76  [1]=>
77  bool(true)
78  [2]=>
79  bool(false)
80  [3]=>
81  bool(false)
82}
83
84-- 'flag' value is SORT_STRING --
85bool(true)
86array(4) {
87  [0]=>
88  bool(true)
89  [1]=>
90  bool(true)
91  [2]=>
92  bool(false)
93  [3]=>
94  bool(false)
95}
96Done