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