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