1--TEST--
2Test rsort() function : usage variations - Hexadecimal vales
3--FILE--
4<?php
5/*
6 * Pass rsort() an array of hexadecimal values to test behaviour
7 */
8
9echo "*** Testing rsort() : variation ***\n";
10
11// an array contains unsorted hexadecimal values
12$unsorted_hex_array = array(0x1AB, 0xFFF, 0xF, 0xFF, 0x2AA, 0xBB, 0x1ab, 0xff, -0xFF, 0, -0x2aa);
13
14echo "\n-- 'flag' value is default  --\n";
15$temp_array = $unsorted_hex_array;
16var_dump(rsort($temp_array) );
17var_dump($temp_array);
18
19echo "\n-- 'flag' value is SORT_REGULAR  --\n";
20$temp_array = $unsorted_hex_array;
21var_dump(rsort($temp_array, SORT_REGULAR) );
22var_dump($temp_array);
23
24echo "\n-- 'flag' value is SORT_NUMERIC  --\n";
25$temp_array = $unsorted_hex_array;
26var_dump(rsort($temp_array, SORT_NUMERIC) );
27var_dump($temp_array);
28
29echo "Done";
30?>
31--EXPECT--
32*** Testing rsort() : variation ***
33
34-- 'flag' value is default  --
35bool(true)
36array(11) {
37  [0]=>
38  int(4095)
39  [1]=>
40  int(682)
41  [2]=>
42  int(427)
43  [3]=>
44  int(427)
45  [4]=>
46  int(255)
47  [5]=>
48  int(255)
49  [6]=>
50  int(187)
51  [7]=>
52  int(15)
53  [8]=>
54  int(0)
55  [9]=>
56  int(-255)
57  [10]=>
58  int(-682)
59}
60
61-- 'flag' value is SORT_REGULAR  --
62bool(true)
63array(11) {
64  [0]=>
65  int(4095)
66  [1]=>
67  int(682)
68  [2]=>
69  int(427)
70  [3]=>
71  int(427)
72  [4]=>
73  int(255)
74  [5]=>
75  int(255)
76  [6]=>
77  int(187)
78  [7]=>
79  int(15)
80  [8]=>
81  int(0)
82  [9]=>
83  int(-255)
84  [10]=>
85  int(-682)
86}
87
88-- 'flag' value is SORT_NUMERIC  --
89bool(true)
90array(11) {
91  [0]=>
92  int(4095)
93  [1]=>
94  int(682)
95  [2]=>
96  int(427)
97  [3]=>
98  int(427)
99  [4]=>
100  int(255)
101  [5]=>
102  int(255)
103  [6]=>
104  int(187)
105  [7]=>
106  int(15)
107  [8]=>
108  int(0)
109  [9]=>
110  int(-255)
111  [10]=>
112  int(-682)
113}
114Done
115