@@ -52,14 +52,14 @@ class for_string_arsort
52
52
53
53
// array of integer objects
54
54
$ unsorted_int_obj = array (
55
- 1 => new for_integer_arsort (11 , 33 ,2 ), 2 => new for_integer_asort (44 , 66 ,3 ),
56
- 3 => new for_integer_arsort (23 , 32 ,6 ), 4 => new for_integer_asort (-88 , -5 ,-4 ),
55
+ 1 => new for_integer_arsort (11 , 33 ,2 ), 2 => new for_integer_arsort (44 , 66 ,3 ),
56
+ 3 => new for_integer_arsort (23 , 32 ,6 ), 4 => new for_integer_arsort (-88 , -5 ,-4 ),
57
57
);
58
58
59
59
// array of string objects
60
60
$ unsorted_str_obj = array (
61
- "a " => new for_string_arsort ("axx " ,"AXX " ,"d " ), "b " => new for_string_asort ("T " , "t " ,"q " ),
62
- "c " => new for_string_arsort ("w " , "W " ,"c " ), "d " => new for_string_asort ("PY " , "py " ,"s " ),
61
+ "a " => new for_string_arsort ("axx " ,"AXX " ,"d " ), "b " => new for_string_arsort ("T " , "t " ,"q " ),
62
+ "c " => new for_string_arsort ("w " , "W " ,"c " ), "d " => new for_string_arsort ("PY " , "py " ,"s " ),
63
63
);
64
64
65
65
@@ -88,10 +88,166 @@ var_dump($temp_array);
88
88
89
89
echo "Done \n" ;
90
90
?>
91
- --EXPECTF --
91
+ --EXPECT --
92
92
*** Testing arsort() : object functionality ***
93
93
94
- Fatal error: Uncaught Error: Class 'for_integer_asort' not found in %sarsort_object2.php:%d
95
- Stack trace:
96
- #0 {main}
97
- thrown in %sarsort_object2.php on line %d
94
+ -- Testing arsort() by supplying various object arrays, 'flag' value is default --
95
+ bool(true)
96
+ array(4) {
97
+ [2]=>
98
+ object(for_integer_arsort)#2 (3) {
99
+ ["public_class_value"]=>
100
+ int(44)
101
+ ["private_class_value":"for_integer_arsort":private]=>
102
+ int(66)
103
+ ["protected_class_value":protected]=>
104
+ int(3)
105
+ }
106
+ [3]=>
107
+ object(for_integer_arsort)#3 (3) {
108
+ ["public_class_value"]=>
109
+ int(23)
110
+ ["private_class_value":"for_integer_arsort":private]=>
111
+ int(32)
112
+ ["protected_class_value":protected]=>
113
+ int(6)
114
+ }
115
+ [1]=>
116
+ object(for_integer_arsort)#1 (3) {
117
+ ["public_class_value"]=>
118
+ int(11)
119
+ ["private_class_value":"for_integer_arsort":private]=>
120
+ int(33)
121
+ ["protected_class_value":protected]=>
122
+ int(2)
123
+ }
124
+ [4]=>
125
+ object(for_integer_arsort)#4 (3) {
126
+ ["public_class_value"]=>
127
+ int(-88)
128
+ ["private_class_value":"for_integer_arsort":private]=>
129
+ int(-5)
130
+ ["protected_class_value":protected]=>
131
+ int(-4)
132
+ }
133
+ }
134
+ bool(true)
135
+ array(4) {
136
+ ["c"]=>
137
+ object(for_string_arsort)#7 (3) {
138
+ ["public_class_value"]=>
139
+ string(1) "w"
140
+ ["private_class_value":"for_string_arsort":private]=>
141
+ string(1) "W"
142
+ ["protected_class_value":protected]=>
143
+ string(1) "c"
144
+ }
145
+ ["a"]=>
146
+ object(for_string_arsort)#5 (3) {
147
+ ["public_class_value"]=>
148
+ string(3) "axx"
149
+ ["private_class_value":"for_string_arsort":private]=>
150
+ string(3) "AXX"
151
+ ["protected_class_value":protected]=>
152
+ string(1) "d"
153
+ }
154
+ ["b"]=>
155
+ object(for_string_arsort)#6 (3) {
156
+ ["public_class_value"]=>
157
+ string(1) "T"
158
+ ["private_class_value":"for_string_arsort":private]=>
159
+ string(1) "t"
160
+ ["protected_class_value":protected]=>
161
+ string(1) "q"
162
+ }
163
+ ["d"]=>
164
+ object(for_string_arsort)#8 (3) {
165
+ ["public_class_value"]=>
166
+ string(2) "PY"
167
+ ["private_class_value":"for_string_arsort":private]=>
168
+ string(2) "py"
169
+ ["protected_class_value":protected]=>
170
+ string(1) "s"
171
+ }
172
+ }
173
+
174
+ -- Testing arsort() by supplying various object arrays, 'flag' value is SORT_REGULAR --
175
+ bool(true)
176
+ array(4) {
177
+ [2]=>
178
+ object(for_integer_arsort)#2 (3) {
179
+ ["public_class_value"]=>
180
+ int(44)
181
+ ["private_class_value":"for_integer_arsort":private]=>
182
+ int(66)
183
+ ["protected_class_value":protected]=>
184
+ int(3)
185
+ }
186
+ [3]=>
187
+ object(for_integer_arsort)#3 (3) {
188
+ ["public_class_value"]=>
189
+ int(23)
190
+ ["private_class_value":"for_integer_arsort":private]=>
191
+ int(32)
192
+ ["protected_class_value":protected]=>
193
+ int(6)
194
+ }
195
+ [1]=>
196
+ object(for_integer_arsort)#1 (3) {
197
+ ["public_class_value"]=>
198
+ int(11)
199
+ ["private_class_value":"for_integer_arsort":private]=>
200
+ int(33)
201
+ ["protected_class_value":protected]=>
202
+ int(2)
203
+ }
204
+ [4]=>
205
+ object(for_integer_arsort)#4 (3) {
206
+ ["public_class_value"]=>
207
+ int(-88)
208
+ ["private_class_value":"for_integer_arsort":private]=>
209
+ int(-5)
210
+ ["protected_class_value":protected]=>
211
+ int(-4)
212
+ }
213
+ }
214
+ bool(true)
215
+ array(4) {
216
+ ["c"]=>
217
+ object(for_string_arsort)#7 (3) {
218
+ ["public_class_value"]=>
219
+ string(1) "w"
220
+ ["private_class_value":"for_string_arsort":private]=>
221
+ string(1) "W"
222
+ ["protected_class_value":protected]=>
223
+ string(1) "c"
224
+ }
225
+ ["a"]=>
226
+ object(for_string_arsort)#5 (3) {
227
+ ["public_class_value"]=>
228
+ string(3) "axx"
229
+ ["private_class_value":"for_string_arsort":private]=>
230
+ string(3) "AXX"
231
+ ["protected_class_value":protected]=>
232
+ string(1) "d"
233
+ }
234
+ ["b"]=>
235
+ object(for_string_arsort)#6 (3) {
236
+ ["public_class_value"]=>
237
+ string(1) "T"
238
+ ["private_class_value":"for_string_arsort":private]=>
239
+ string(1) "t"
240
+ ["protected_class_value":protected]=>
241
+ string(1) "q"
242
+ }
243
+ ["d"]=>
244
+ object(for_string_arsort)#8 (3) {
245
+ ["public_class_value"]=>
246
+ string(2) "PY"
247
+ ["private_class_value":"for_string_arsort":private]=>
248
+ string(2) "py"
249
+ ["protected_class_value":protected]=>
250
+ string(1) "s"
251
+ }
252
+ }
253
+ Done
0 commit comments