File tree Expand file tree Collapse file tree 3 files changed +133
-380
lines changed Expand file tree Collapse file tree 3 files changed +133
-380
lines changed Original file line number Diff line number Diff line change @@ -8,164 +8,83 @@ if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
8
8
?>
9
9
--FILE--
10
10
<?php
11
- echo "*** Testing pow() : usage variations *** \n" ;
12
11
13
- //get an unset variable
14
- $ unset_var = 10 ;
15
- unset ($ unset_var );
16
-
17
- // heredoc string
18
- $ heredoc = <<<EOT
19
- abc
20
- xyz
21
- EOT ;
22
-
23
- // get a class
24
12
class classA
25
13
{
26
14
}
27
15
28
- // get a resource variable
16
+ //resource variable
29
17
$ fp = fopen (__FILE__ , "r " );
30
18
31
- $ inputs = array (
32
- // int data
33
- /*1*/ 0 ,
34
- 1 ,
35
- 12345 ,
36
- -2345 ,
37
- PHP_INT_MAX ,
38
-
39
- // float data
40
- /*6*/ 10.5 ,
41
- -10.5 ,
42
- 12.3456789000e10 ,
43
- 12.3456789000E-10 ,
44
- .5 ,
45
-
46
- // null data
47
- /*11*/ NULL ,
48
- null ,
49
-
50
- // boolean data
51
- /*13*/ true ,
52
- false ,
53
- TRUE ,
54
- FALSE ,
55
-
56
- // empty data
57
- /*17*/ "" ,
58
- '' ,
59
- array (),
60
-
61
- // string data
62
- /*20*/ "abcxyz " ,
63
- 'abcxyz ' ,
64
- $ heredoc ,
65
-
66
- // object data
67
- /*23*/ new classA (),
68
-
69
- // undefined data
70
- /*24*/ @$ undefined_var ,
71
-
72
- // unset data
73
- /*25*/ @$ unset_var ,
74
-
75
- // resource variable
76
- /*26*/ $ fp
77
- );
19
+ $ inputs = [
20
+ // int data
21
+ 0 ,
22
+ 1 ,
23
+ 12345 ,
24
+ -2345 ,
25
+ PHP_INT_MAX ,
26
+
27
+ // float data
28
+ 10.5 ,
29
+ -10.5 ,
30
+ 12.3456789e10 ,
31
+ 12.3456789e-10 ,
32
+ 0.5 ,
33
+
34
+ // null data
35
+ null ,
36
+
37
+ // boolean data
38
+ true ,
39
+ false ,
40
+
41
+ // empty data
42
+ "" ,
43
+ [],
44
+
45
+ // string data
46
+ "abcxyz " ,
47
+ "5.5 " ,
48
+ "2 " ,
49
+ "6.3e-2 " ,
50
+
51
+ // object data
52
+ new classA (),
53
+
54
+ // resource variable
55
+ $ fp ,
56
+ ];
78
57
79
58
// loop through each element of $inputs to check the behaviour of pow()
80
- $ iterator = 1 ;
81
- foreach ($ inputs as $ input ) {
82
- echo "\n-- Iteration $ iterator -- \n" ;
59
+ foreach ($ inputs as $ input ) {
83
60
try {
84
61
var_dump (pow ($ input , 3 ));
85
62
} catch (Error $ e ) {
86
63
echo $ e ->getMessage (), "\n" ;
87
64
}
88
- $ iterator ++;
89
- };
65
+ }
90
66
fclose ($ fp );
67
+
91
68
?>
92
69
--EXPECTF--
93
- *** Testing pow() : usage variations ***
94
-
95
- -- Iteration 1 --
96
70
int(0)
97
-
98
- -- Iteration 2 --
99
71
int(1)
100
-
101
- -- Iteration 3 --
102
72
float(1881365963625)
103
-
104
- -- Iteration 4 --
105
73
float(-12895213625)
106
-
107
- -- Iteration 5 --
108
74
float(9.903520300448E+27)
109
-
110
- -- Iteration 6 --
111
75
float(1157.625)
112
-
113
- -- Iteration 7 --
114
76
float(-1157.625)
115
-
116
- -- Iteration 8 --
117
77
float(1.881676371789%dE+33)
118
-
119
- -- Iteration 9 --
120
78
float(1.881676371789%dE-27)
121
-
122
- -- Iteration 10 --
123
79
float(0.125)
124
-
125
- -- Iteration 11 --
126
80
int(0)
127
-
128
- -- Iteration 12 --
129
- int(0)
130
-
131
- -- Iteration 13 --
132
- int(1)
133
-
134
- -- Iteration 14 --
135
- int(0)
136
-
137
- -- Iteration 15 --
138
81
int(1)
139
-
140
- -- Iteration 16 --
141
82
int(0)
142
-
143
- -- Iteration 17 --
144
83
Unsupported operand types: string ** int
145
-
146
- -- Iteration 18 --
147
- Unsupported operand types: string ** int
148
-
149
- -- Iteration 19 --
150
84
Unsupported operand types: array ** int
151
-
152
- -- Iteration 20 --
153
- Unsupported operand types: string ** int
154
-
155
- -- Iteration 21 --
156
85
Unsupported operand types: string ** int
157
-
158
- -- Iteration 22 --
159
- Unsupported operand types: string ** int
160
-
161
- -- Iteration 23 --
86
+ float(166.375)
87
+ int(8)
88
+ float(0.000250047)
162
89
Unsupported operand types: classA ** int
163
-
164
- -- Iteration 24 --
165
- int(0)
166
-
167
- -- Iteration 25 --
168
- int(0)
169
-
170
- -- Iteration 26 --
171
90
Unsupported operand types: resource ** int
You can’t perform that action at this time.
0 commit comments