1--TEST--
2Test rsort() function : usage variations - Octal values
3--FILE--
4<?php
5/*
6 * Pass rsort() an array containing octal values to test behaviour
7 */
8
9echo "*** Testing rsort() : variation ***\n";
10
11// an array containing unsorted octal values
12$unsorted_oct_array = array(01235, 0321, 0345, 066, 0772, 077, -066, -0345, 0);
13
14echo "\n-- Sort flag = default  --\n";
15$temp_array = $unsorted_oct_array;
16var_dump(rsort($temp_array) );
17var_dump($temp_array);
18
19echo "\n-- Sort flag = SORT_REGULAR  --\n";
20$temp_array = $unsorted_oct_array;
21var_dump(rsort($temp_array, SORT_REGULAR) );
22var_dump($temp_array);
23
24echo "\n-- Sort flag = SORT_NUMERIC  --\n";
25$temp_array = $unsorted_oct_array;
26var_dump(rsort($temp_array, SORT_NUMERIC) );
27var_dump($temp_array);
28
29echo "Done";
30?>
31--EXPECT--
32*** Testing rsort() : variation ***
33
34-- Sort flag = default  --
35bool(true)
36array(9) {
37  [0]=>
38  int(669)
39  [1]=>
40  int(506)
41  [2]=>
42  int(229)
43  [3]=>
44  int(209)
45  [4]=>
46  int(63)
47  [5]=>
48  int(54)
49  [6]=>
50  int(0)
51  [7]=>
52  int(-54)
53  [8]=>
54  int(-229)
55}
56
57-- Sort flag = SORT_REGULAR  --
58bool(true)
59array(9) {
60  [0]=>
61  int(669)
62  [1]=>
63  int(506)
64  [2]=>
65  int(229)
66  [3]=>
67  int(209)
68  [4]=>
69  int(63)
70  [5]=>
71  int(54)
72  [6]=>
73  int(0)
74  [7]=>
75  int(-54)
76  [8]=>
77  int(-229)
78}
79
80-- Sort flag = SORT_NUMERIC  --
81bool(true)
82array(9) {
83  [0]=>
84  int(669)
85  [1]=>
86  int(506)
87  [2]=>
88  int(229)
89  [3]=>
90  int(209)
91  [4]=>
92  int(63)
93  [5]=>
94  int(54)
95  [6]=>
96  int(0)
97  [7]=>
98  int(-54)
99  [8]=>
100  int(-229)
101}
102Done
103