1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
--TEST--
Test range() function with null as argument.
--INI--
serialize_precision=14
--FILE--
<?php
echo "range(null, null)\n";
var_dump( range(null, null) );
echo "null with int boundary\n";
var_dump( range(null, 5) );
var_dump( range(5, null) );
echo "null with float boundary\n";
var_dump( range(null, 4.5) );
var_dump( range(4.5, null) );
echo "null with string boundary\n";
var_dump( range(null, 'e') );
var_dump( range('e', null) );
echo "Done\n";
?>
--EXPECTF--
range(null, null)
Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
array(1) {
[0]=>
int(0)
}
null with int boundary
Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
array(6) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
[3]=>
int(3)
[4]=>
int(4)
[5]=>
int(5)
}
Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
array(6) {
[0]=>
int(5)
[1]=>
int(4)
[2]=>
int(3)
[3]=>
int(2)
[4]=>
int(1)
[5]=>
int(0)
}
null with float boundary
Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
array(5) {
[0]=>
float(0)
[1]=>
float(1)
[2]=>
float(2)
[3]=>
float(3)
[4]=>
float(4)
}
Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
array(5) {
[0]=>
float(4.5)
[1]=>
float(3.5)
[2]=>
float(2.5)
[3]=>
float(1.5)
[4]=>
float(0.5)
}
null with string boundary
Deprecated: range(): Passing null to parameter #1 ($start) of type string|int|float is deprecated in %s on line %d
Warning: range(): Argument #1 ($start) must be a single byte string if argument #2 ($end) is a single byte string, argument #2 ($end) converted to 0 in %s on line %d
array(1) {
[0]=>
int(0)
}
Deprecated: range(): Passing null to parameter #2 ($end) of type string|int|float is deprecated in %s on line %d
Warning: range(): Argument #2 ($end) must be a single byte string if argument #1 ($start) is a single byte string, argument #1 ($start) converted to 0 in %s on line %d
array(1) {
[0]=>
int(0)
}
Done
|