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