1--TEST--
2Test range() function (variation-1)
3--INI--
4precision=14
5--FILE--
6<?php
7
8echo "\n*** Testing range() with various low and high values ***";
9$low_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
10$high_arr = array( "ABCD", -10.5555, TRUE, NULL, FALSE, "", array(1,2));
11
12for( $i = 0; $i < count($low_arr); $i++) {
13  for( $j = 0; $j < count($high_arr); $j++) {
14    echo @"\n-- creating an array with low = '$low_arr[$i]' and high = '$high_arr[$j]' --\n";
15    var_dump( range( $low_arr[$i], $high_arr[$j] ) );
16  }
17}
18
19echo "\n*** Possible variatins with steps ***\n";
20var_dump( range( 1, 5, TRUE ) );
21var_dump( range( 1, 5, array(1, 2) ) );
22
23echo "Done\n";
24?>
25--EXPECTF--
26*** Testing range() with various low and high values ***
27-- creating an array with low = 'ABCD' and high = 'ABCD' --
28array(1) {
29  [0]=>
30  string(1) "A"
31}
32
33-- creating an array with low = 'ABCD' and high = '-10.5555' --
34array(11) {
35  [0]=>
36  float(0)
37  [1]=>
38  float(-1)
39  [2]=>
40  float(-2)
41  [3]=>
42  float(-3)
43  [4]=>
44  float(-4)
45  [5]=>
46  float(-5)
47  [6]=>
48  float(-6)
49  [7]=>
50  float(-7)
51  [8]=>
52  float(-8)
53  [9]=>
54  float(-9)
55  [10]=>
56  float(-10)
57}
58
59-- creating an array with low = 'ABCD' and high = '1' --
60array(2) {
61  [0]=>
62  int(0)
63  [1]=>
64  int(1)
65}
66
67-- creating an array with low = 'ABCD' and high = '' --
68array(1) {
69  [0]=>
70  int(0)
71}
72
73-- creating an array with low = 'ABCD' and high = '' --
74array(1) {
75  [0]=>
76  int(0)
77}
78
79-- creating an array with low = 'ABCD' and high = '' --
80array(1) {
81  [0]=>
82  int(0)
83}
84
85-- creating an array with low = 'ABCD' and high = 'Array' --
86array(2) {
87  [0]=>
88  int(0)
89  [1]=>
90  int(1)
91}
92
93-- creating an array with low = '-10.5555' and high = 'ABCD' --
94array(11) {
95  [0]=>
96  float(-10.5555)
97  [1]=>
98  float(-9.5555)
99  [2]=>
100  float(-8.5555)
101  [3]=>
102  float(-7.5555)
103  [4]=>
104  float(-6.5555)
105  [5]=>
106  float(-5.5555)
107  [6]=>
108  float(-4.5555)
109  [7]=>
110  float(-3.5555)
111  [8]=>
112  float(-2.5555)
113  [9]=>
114  float(-1.5555)
115  [10]=>
116  float(-0.5555)
117}
118
119-- creating an array with low = '-10.5555' and high = '-10.5555' --
120array(1) {
121  [0]=>
122  float(-10.5555)
123}
124
125-- creating an array with low = '-10.5555' and high = '1' --
126array(12) {
127  [0]=>
128  float(-10.5555)
129  [1]=>
130  float(-9.5555)
131  [2]=>
132  float(-8.5555)
133  [3]=>
134  float(-7.5555)
135  [4]=>
136  float(-6.5555)
137  [5]=>
138  float(-5.5555)
139  [6]=>
140  float(-4.5555)
141  [7]=>
142  float(-3.5555)
143  [8]=>
144  float(-2.5555)
145  [9]=>
146  float(-1.5555)
147  [10]=>
148  float(-0.5555)
149  [11]=>
150  float(0.4445)
151}
152
153-- creating an array with low = '-10.5555' and high = '' --
154array(11) {
155  [0]=>
156  float(-10.5555)
157  [1]=>
158  float(-9.5555)
159  [2]=>
160  float(-8.5555)
161  [3]=>
162  float(-7.5555)
163  [4]=>
164  float(-6.5555)
165  [5]=>
166  float(-5.5555)
167  [6]=>
168  float(-4.5555)
169  [7]=>
170  float(-3.5555)
171  [8]=>
172  float(-2.5555)
173  [9]=>
174  float(-1.5555)
175  [10]=>
176  float(-0.5555)
177}
178
179-- creating an array with low = '-10.5555' and high = '' --
180array(11) {
181  [0]=>
182  float(-10.5555)
183  [1]=>
184  float(-9.5555)
185  [2]=>
186  float(-8.5555)
187  [3]=>
188  float(-7.5555)
189  [4]=>
190  float(-6.5555)
191  [5]=>
192  float(-5.5555)
193  [6]=>
194  float(-4.5555)
195  [7]=>
196  float(-3.5555)
197  [8]=>
198  float(-2.5555)
199  [9]=>
200  float(-1.5555)
201  [10]=>
202  float(-0.5555)
203}
204
205-- creating an array with low = '-10.5555' and high = '' --
206array(11) {
207  [0]=>
208  float(-10.5555)
209  [1]=>
210  float(-9.5555)
211  [2]=>
212  float(-8.5555)
213  [3]=>
214  float(-7.5555)
215  [4]=>
216  float(-6.5555)
217  [5]=>
218  float(-5.5555)
219  [6]=>
220  float(-4.5555)
221  [7]=>
222  float(-3.5555)
223  [8]=>
224  float(-2.5555)
225  [9]=>
226  float(-1.5555)
227  [10]=>
228  float(-0.5555)
229}
230
231-- creating an array with low = '-10.5555' and high = 'Array' --
232array(12) {
233  [0]=>
234  float(-10.5555)
235  [1]=>
236  float(-9.5555)
237  [2]=>
238  float(-8.5555)
239  [3]=>
240  float(-7.5555)
241  [4]=>
242  float(-6.5555)
243  [5]=>
244  float(-5.5555)
245  [6]=>
246  float(-4.5555)
247  [7]=>
248  float(-3.5555)
249  [8]=>
250  float(-2.5555)
251  [9]=>
252  float(-1.5555)
253  [10]=>
254  float(-0.5555)
255  [11]=>
256  float(0.4445)
257}
258
259-- creating an array with low = '1' and high = 'ABCD' --
260array(2) {
261  [0]=>
262  int(1)
263  [1]=>
264  int(0)
265}
266
267-- creating an array with low = '1' and high = '-10.5555' --
268array(12) {
269  [0]=>
270  float(1)
271  [1]=>
272  float(0)
273  [2]=>
274  float(-1)
275  [3]=>
276  float(-2)
277  [4]=>
278  float(-3)
279  [5]=>
280  float(-4)
281  [6]=>
282  float(-5)
283  [7]=>
284  float(-6)
285  [8]=>
286  float(-7)
287  [9]=>
288  float(-8)
289  [10]=>
290  float(-9)
291  [11]=>
292  float(-10)
293}
294
295-- creating an array with low = '1' and high = '1' --
296array(1) {
297  [0]=>
298  int(1)
299}
300
301-- creating an array with low = '1' and high = '' --
302array(2) {
303  [0]=>
304  int(1)
305  [1]=>
306  int(0)
307}
308
309-- creating an array with low = '1' and high = '' --
310array(2) {
311  [0]=>
312  int(1)
313  [1]=>
314  int(0)
315}
316
317-- creating an array with low = '1' and high = '' --
318array(2) {
319  [0]=>
320  int(1)
321  [1]=>
322  int(0)
323}
324
325-- creating an array with low = '1' and high = 'Array' --
326array(1) {
327  [0]=>
328  int(1)
329}
330
331-- creating an array with low = '' and high = 'ABCD' --
332array(1) {
333  [0]=>
334  int(0)
335}
336
337-- creating an array with low = '' and high = '-10.5555' --
338array(11) {
339  [0]=>
340  float(0)
341  [1]=>
342  float(-1)
343  [2]=>
344  float(-2)
345  [3]=>
346  float(-3)
347  [4]=>
348  float(-4)
349  [5]=>
350  float(-5)
351  [6]=>
352  float(-6)
353  [7]=>
354  float(-7)
355  [8]=>
356  float(-8)
357  [9]=>
358  float(-9)
359  [10]=>
360  float(-10)
361}
362
363-- creating an array with low = '' and high = '1' --
364array(2) {
365  [0]=>
366  int(0)
367  [1]=>
368  int(1)
369}
370
371-- creating an array with low = '' and high = '' --
372array(1) {
373  [0]=>
374  int(0)
375}
376
377-- creating an array with low = '' and high = '' --
378array(1) {
379  [0]=>
380  int(0)
381}
382
383-- creating an array with low = '' and high = '' --
384array(1) {
385  [0]=>
386  int(0)
387}
388
389-- creating an array with low = '' and high = 'Array' --
390array(2) {
391  [0]=>
392  int(0)
393  [1]=>
394  int(1)
395}
396
397-- creating an array with low = '' and high = 'ABCD' --
398array(1) {
399  [0]=>
400  int(0)
401}
402
403-- creating an array with low = '' and high = '-10.5555' --
404array(11) {
405  [0]=>
406  float(0)
407  [1]=>
408  float(-1)
409  [2]=>
410  float(-2)
411  [3]=>
412  float(-3)
413  [4]=>
414  float(-4)
415  [5]=>
416  float(-5)
417  [6]=>
418  float(-6)
419  [7]=>
420  float(-7)
421  [8]=>
422  float(-8)
423  [9]=>
424  float(-9)
425  [10]=>
426  float(-10)
427}
428
429-- creating an array with low = '' and high = '1' --
430array(2) {
431  [0]=>
432  int(0)
433  [1]=>
434  int(1)
435}
436
437-- creating an array with low = '' and high = '' --
438array(1) {
439  [0]=>
440  int(0)
441}
442
443-- creating an array with low = '' and high = '' --
444array(1) {
445  [0]=>
446  int(0)
447}
448
449-- creating an array with low = '' and high = '' --
450array(1) {
451  [0]=>
452  int(0)
453}
454
455-- creating an array with low = '' and high = 'Array' --
456array(2) {
457  [0]=>
458  int(0)
459  [1]=>
460  int(1)
461}
462
463-- creating an array with low = '' and high = 'ABCD' --
464array(1) {
465  [0]=>
466  int(0)
467}
468
469-- creating an array with low = '' and high = '-10.5555' --
470array(11) {
471  [0]=>
472  float(0)
473  [1]=>
474  float(-1)
475  [2]=>
476  float(-2)
477  [3]=>
478  float(-3)
479  [4]=>
480  float(-4)
481  [5]=>
482  float(-5)
483  [6]=>
484  float(-6)
485  [7]=>
486  float(-7)
487  [8]=>
488  float(-8)
489  [9]=>
490  float(-9)
491  [10]=>
492  float(-10)
493}
494
495-- creating an array with low = '' and high = '1' --
496array(2) {
497  [0]=>
498  int(0)
499  [1]=>
500  int(1)
501}
502
503-- creating an array with low = '' and high = '' --
504array(1) {
505  [0]=>
506  int(0)
507}
508
509-- creating an array with low = '' and high = '' --
510array(1) {
511  [0]=>
512  int(0)
513}
514
515-- creating an array with low = '' and high = '' --
516array(1) {
517  [0]=>
518  int(0)
519}
520
521-- creating an array with low = '' and high = 'Array' --
522array(2) {
523  [0]=>
524  int(0)
525  [1]=>
526  int(1)
527}
528
529-- creating an array with low = 'Array' and high = 'ABCD' --
530array(2) {
531  [0]=>
532  int(1)
533  [1]=>
534  int(0)
535}
536
537-- creating an array with low = 'Array' and high = '-10.5555' --
538array(12) {
539  [0]=>
540  float(1)
541  [1]=>
542  float(0)
543  [2]=>
544  float(-1)
545  [3]=>
546  float(-2)
547  [4]=>
548  float(-3)
549  [5]=>
550  float(-4)
551  [6]=>
552  float(-5)
553  [7]=>
554  float(-6)
555  [8]=>
556  float(-7)
557  [9]=>
558  float(-8)
559  [10]=>
560  float(-9)
561  [11]=>
562  float(-10)
563}
564
565-- creating an array with low = 'Array' and high = '1' --
566array(1) {
567  [0]=>
568  int(1)
569}
570
571-- creating an array with low = 'Array' and high = '' --
572array(2) {
573  [0]=>
574  int(1)
575  [1]=>
576  int(0)
577}
578
579-- creating an array with low = 'Array' and high = '' --
580array(2) {
581  [0]=>
582  int(1)
583  [1]=>
584  int(0)
585}
586
587-- creating an array with low = 'Array' and high = '' --
588array(2) {
589  [0]=>
590  int(1)
591  [1]=>
592  int(0)
593}
594
595-- creating an array with low = 'Array' and high = 'Array' --
596array(1) {
597  [0]=>
598  int(1)
599}
600
601*** Possible variatins with steps ***
602array(5) {
603  [0]=>
604  int(1)
605  [1]=>
606  int(2)
607  [2]=>
608  int(3)
609  [3]=>
610  int(4)
611  [4]=>
612  int(5)
613}
614array(5) {
615  [0]=>
616  int(1)
617  [1]=>
618  int(2)
619  [2]=>
620  int(3)
621  [3]=>
622  int(4)
623  [4]=>
624  int(5)
625}
626Done
627