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
37--EXPECTF--
38*** Testing rsort() : variation ***
39
40-- Sort flag = default  --
41bool(true)
42array(9) {
43  [0]=>
44  int(669)
45  [1]=>
46  int(506)
47  [2]=>
48  int(229)
49  [3]=>
50  int(209)
51  [4]=>
52  int(63)
53  [5]=>
54  int(54)
55  [6]=>
56  int(0)
57  [7]=>
58  int(-54)
59  [8]=>
60  int(-229)
61}
62
63-- Sort flag = SORT_REGULAR  --
64bool(true)
65array(9) {
66  [0]=>
67  int(669)
68  [1]=>
69  int(506)
70  [2]=>
71  int(229)
72  [3]=>
73  int(209)
74  [4]=>
75  int(63)
76  [5]=>
77  int(54)
78  [6]=>
79  int(0)
80  [7]=>
81  int(-54)
82  [8]=>
83  int(-229)
84}
85
86-- Sort flag = SORT_NUMERIC  --
87bool(true)
88array(9) {
89  [0]=>
90  int(669)
91  [1]=>
92  int(506)
93  [2]=>
94  int(229)
95  [3]=>
96  int(209)
97  [4]=>
98  int(63)
99  [5]=>
100  int(54)
101  [6]=>
102  int(0)
103  [7]=>
104  int(-54)
105  [8]=>
106  int(-229)
107}
108Done