1--TEST-- 2Test rsort() function : usage variations - mixed array 3--FILE-- 4<?php 5/* 6 * Pass rsort() an array of different data types to test behaviour 7 */ 8 9echo "*** Testing rsort() : variation ***\n"; 10 11// mixed value array 12$mixed_values = array ( 13 array(), 14 array( array(33, -5, 6), 15 array(11), 16 array(22, -55), 17 array() 18 ), 19 -4, "4", 4.00, "b", "5", -2, -2.0, -2.98989, "-.9", "True", "", 20 NULL, "ab", "abcd", 0.0, -0, "abcd\x00abcd\x00abcd", '', true, false 21); 22 23echo "\n-- Sort flag = default --\n"; 24$temp_array = $mixed_values; 25var_dump(rsort($temp_array) ); 26var_dump($temp_array); 27 28echo "\n-- Sort flag = SORT_REGULAR --\n"; 29$temp_array = $mixed_values; 30var_dump(rsort($temp_array, SORT_REGULAR) ); 31var_dump($temp_array); 32 33echo "Done"; 34?> 35--EXPECTF-- 36*** Testing rsort() : variation *** 37 38-- Sort flag = default -- 39bool(true) 40array(22) { 41 [0]=> 42 array(4) { 43 [0]=> 44 array(3) { 45 [0]=> 46 int(33) 47 [1]=> 48 int(-5) 49 [2]=> 50 int(6) 51 } 52 [1]=> 53 array(1) { 54 [0]=> 55 int(11) 56 } 57 [2]=> 58 array(2) { 59 [0]=> 60 int(22) 61 [1]=> 62 int(-55) 63 } 64 [3]=> 65 array(0) { 66 } 67 } 68 [1]=> 69 array(0) { 70 } 71 [2]=> 72 string(1) "b" 73 [3]=> 74 string(14) "abcd%0abcd%0abcd" 75 [4]=> 76 string(4) "abcd" 77 [5]=> 78 string(2) "ab" 79 [6]=> 80 string(4) "True" 81 [7]=> 82 string(1) "5" 83 [8]=> 84 string(1) "4" 85 [9]=> 86 float(4) 87 [10]=> 88 string(3) "-.9" 89 [11]=> 90 int(-2) 91 [12]=> 92 float(-2) 93 [13]=> 94 float(-2.98989) 95 [14]=> 96 bool(true) 97 [15]=> 98 string(0) "" 99 [16]=> 100 NULL 101 [17]=> 102 float(0) 103 [18]=> 104 int(0) 105 [19]=> 106 int(-4) 107 [20]=> 108 string(0) "" 109 [21]=> 110 bool(false) 111} 112 113-- Sort flag = SORT_REGULAR -- 114bool(true) 115array(22) { 116 [0]=> 117 array(4) { 118 [0]=> 119 array(3) { 120 [0]=> 121 int(33) 122 [1]=> 123 int(-5) 124 [2]=> 125 int(6) 126 } 127 [1]=> 128 array(1) { 129 [0]=> 130 int(11) 131 } 132 [2]=> 133 array(2) { 134 [0]=> 135 int(22) 136 [1]=> 137 int(-55) 138 } 139 [3]=> 140 array(0) { 141 } 142 } 143 [1]=> 144 array(0) { 145 } 146 [2]=> 147 string(1) "b" 148 [3]=> 149 string(14) "abcd%0abcd%0abcd" 150 [4]=> 151 string(4) "abcd" 152 [5]=> 153 string(2) "ab" 154 [6]=> 155 string(4) "True" 156 [7]=> 157 string(1) "5" 158 [8]=> 159 string(1) "4" 160 [9]=> 161 float(4) 162 [10]=> 163 string(3) "-.9" 164 [11]=> 165 int(-2) 166 [12]=> 167 float(-2) 168 [13]=> 169 float(-2.98989) 170 [14]=> 171 bool(true) 172 [15]=> 173 string(0) "" 174 [16]=> 175 NULL 176 [17]=> 177 float(0) 178 [18]=> 179 int(0) 180 [19]=> 181 int(-4) 182 [20]=> 183 string(0) "" 184 [21]=> 185 bool(false) 186} 187Done 188