Annotation of embedaddon/php/ext/standard/tests/array/natcasesort_variation9.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test 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:
15: echo "*** 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
28: var_dump( @natcasesort($mixed_values) );
29:
30: var_dump($mixed_values);
31:
32: echo "Done";
33: ?>
34:
35: --EXPECTF--
36: *** Testing natcasesort() : usage variation ***
37: bool(true)
38: array(22) {
39: [13]=>
40: NULL
41: [19]=>
42: string(0) ""
43: [21]=>
44: bool(false)
45: [12]=>
46: string(0) ""
47: [10]=>
48: string(3) "-.9"
49: [7]=>
50: int(-2)
51: [8]=>
52: float(-2)
53: [9]=>
54: float(-2.98989)
55: [2]=>
56: int(-4)
57: [16]=>
58: float(0)
59: [17]=>
60: int(0)
61: [20]=>
62: bool(true)
63: [3]=>
64: string(1) "4"
65: [4]=>
66: float(4)
67: [6]=>
68: string(1) "5"
69: [14]=>
70: string(2) "ab"
71: [15]=>
72: string(4) "abcd"
73: [18]=>
74: string(14) "%s"
75: [0]=>
76: array(0) {
77: }
78: [1]=>
79: array(4) {
80: [0]=>
81: array(3) {
82: [0]=>
83: int(33)
84: [1]=>
85: int(-5)
86: [2]=>
87: int(6)
88: }
89: [1]=>
90: array(1) {
91: [0]=>
92: int(11)
93: }
94: [2]=>
95: array(2) {
96: [0]=>
97: int(22)
98: [1]=>
99: int(-55)
100: }
101: [3]=>
102: array(0) {
103: }
104: }
105: [5]=>
106: string(1) "b"
107: [11]=>
108: string(4) "True"
109: }
110: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>