1--TEST--
2Test natcasesort() function : usage variations - mixed array
3--FILE--
4<?php
5/* Prototype  : bool natcasesort(array &$array_arg)
6 * Description: Sort an array using case-insensitive natural sort
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Pass an array containing sub-arrays, ints, floats, strings, boolean, null
12 * and escape characters to test how natcasesort() re-orders it
13 */
14
15echo "*** Testing natcasesort() : usage variation ***\n";
16
17$mixed_values = array (
18  array(),
19  array( array(33, -5, 6),
20         array(11),
21         array(22, -55),
22         array()
23       ),
24  -4, "4", 4.00, "b", "5", -2, -2.0, -2.98989, "-.9", "True", "",
25  NULL, "ab", "abcd", 0.0, -0, "abcd\x00abcd\x00abcd", '', true, false
26);
27// suppress errors as is generating a lot of "array to string" notices
28var_dump( @natcasesort($mixed_values) );
29
30var_dump($mixed_values);
31
32echo "Done";
33?>
34--EXPECT--
35*** Testing natcasesort() : usage variation ***
36bool(true)
37array(22) {
38  [21]=>
39  bool(false)
40  [13]=>
41  NULL
42  [12]=>
43  string(0) ""
44  [19]=>
45  string(0) ""
46  [10]=>
47  string(3) "-.9"
48  [7]=>
49  int(-2)
50  [8]=>
51  float(-2)
52  [9]=>
53  float(-2.98989)
54  [2]=>
55  int(-4)
56  [16]=>
57  float(0)
58  [17]=>
59  int(0)
60  [20]=>
61  bool(true)
62  [4]=>
63  float(4)
64  [3]=>
65  string(1) "4"
66  [6]=>
67  string(1) "5"
68  [14]=>
69  string(2) "ab"
70  [15]=>
71  string(4) "abcd"
72  [18]=>
73  string(14) "abcd�abcd�abcd"
74  [0]=>
75  array(0) {
76  }
77  [1]=>
78  array(4) {
79    [0]=>
80    array(3) {
81      [0]=>
82      int(33)
83      [1]=>
84      int(-5)
85      [2]=>
86      int(6)
87    }
88    [1]=>
89    array(1) {
90      [0]=>
91      int(11)
92    }
93    [2]=>
94    array(2) {
95      [0]=>
96      int(22)
97      [1]=>
98      int(-55)
99    }
100    [3]=>
101    array(0) {
102    }
103  }
104  [5]=>
105  string(1) "b"
106  [11]=>
107  string(4) "True"
108}
109Done
110