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