1--TEST--
2Test natcasesort() function : usage variations - different numeric types
3--SKIPIF--
4<?php
5if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
6?>
7--FILE--
8<?php
9/*
10 * Pass arrays of numeric data to test how natcasesort re-orders the array
11 */
12
13echo "*** Testing natcasesort() : usage variation ***\n";
14
15$inputs = array (
16
17  // negative/positive integers array
18  array(11, -11, 21, -21, 31, -31, 0, 41, -41),
19
20  // float value array
21  array(10.5, -10.5, 10.5e2, 10.6E-2, .5, .01, -.1),
22
23  // mixed value array
24  array(.0001, .0021, -.01, -1, 0, .09, 2, -.9, 10.6E-2, -10.6E-2, 33),
25
26  // array values contains minimum and maximum ranges
27  array(2147483647, 2147483648, -2147483647, -2147483648, -0, 0, -2147483649)
28);
29
30$iterator = 1;
31foreach ($inputs as $array_arg) {
32    echo "\n-- Iteration $iterator --\n";
33    var_dump(natcasesort($array_arg));
34    var_dump($array_arg);
35}
36
37echo "Done";
38?>
39--EXPECT--
40*** Testing natcasesort() : usage variation ***
41
42-- Iteration 1 --
43bool(true)
44array(9) {
45  [1]=>
46  int(-11)
47  [3]=>
48  int(-21)
49  [5]=>
50  int(-31)
51  [8]=>
52  int(-41)
53  [6]=>
54  int(0)
55  [0]=>
56  int(11)
57  [2]=>
58  int(21)
59  [4]=>
60  int(31)
61  [7]=>
62  int(41)
63}
64
65-- Iteration 1 --
66bool(true)
67array(7) {
68  [6]=>
69  float(-0.1)
70  [1]=>
71  float(-10.5)
72  [5]=>
73  float(0.01)
74  [4]=>
75  float(0.5)
76  [3]=>
77  float(0.106)
78  [0]=>
79  float(10.5)
80  [2]=>
81  float(1050)
82}
83
84-- Iteration 1 --
85bool(true)
86array(11) {
87  [2]=>
88  float(-0.01)
89  [7]=>
90  float(-0.9)
91  [9]=>
92  float(-0.106)
93  [3]=>
94  int(-1)
95  [4]=>
96  int(0)
97  [0]=>
98  float(0.0001)
99  [1]=>
100  float(0.0021)
101  [5]=>
102  float(0.09)
103  [8]=>
104  float(0.106)
105  [6]=>
106  int(2)
107  [10]=>
108  int(33)
109}
110
111-- Iteration 1 --
112bool(true)
113array(7) {
114  [2]=>
115  int(-2147483647)
116  [3]=>
117  float(-2147483648)
118  [6]=>
119  float(-2147483649)
120  [4]=>
121  int(0)
122  [5]=>
123  int(0)
124  [0]=>
125  int(2147483647)
126  [1]=>
127  float(2147483648)
128}
129Done
130