1--TEST--
2Test pow() function : usage variations - different data types as $exp argument
3--INI--
4serialize_precision = 14
5--FILE--
6<?php
7echo "*** Testing pow() : usage variations ***\n";
8
9//get an unset variable
10$unset_var = 10;
11unset ($unset_var);
12
13// heredoc string
14$heredoc = <<<EOT
15abc
16xyz
17EOT;
18
19// get a class
20class classA
21{
22}
23
24// get a resource variable
25$fp = fopen(__FILE__, "r");
26
27$inputs = array(
28       // int data
29/*1*/  0,
30       1,
31       12345,
32       -2345,
33       2147483647,
34
35       // float data
36/*6*/  2.5,
37       -2.5,
38       12.3456789000e10,
39       12.3456789000E-10,
40       .5,
41
42       // null data
43/*11*/ NULL,
44       null,
45
46       // boolean data
47/*13*/ true,
48       false,
49       TRUE,
50       FALSE,
51
52       // empty data
53/*17*/ "",
54       '',
55       array(),
56
57       // string data
58/*20*/ "abcxyz",
59       'abcxyz',
60       $heredoc,
61
62       // object data
63/*23*/ new classA(),
64
65       // undefined data
66/*24*/ @$undefined_var,
67
68       // unset data
69/*25*/ @$unset_var,
70
71       // resource variable
72/*26*/ $fp
73);
74
75// loop through each element of $inputs to check the behaviour of pow()
76$iterator = 1;
77foreach($inputs as $input) {
78    echo "\n-- Iteration $iterator --\n";
79    try {
80        var_dump(pow(20.3, $input));
81    } catch (Error $e) {
82        echo $e->getMessage(), "\n";
83    }
84    $iterator++;
85};
86fclose($fp);
87?>
88--EXPECT--
89*** Testing pow() : usage variations ***
90
91-- Iteration 1 --
92float(1)
93
94-- Iteration 2 --
95float(20.3)
96
97-- Iteration 3 --
98float(INF)
99
100-- Iteration 4 --
101float(0)
102
103-- Iteration 5 --
104float(INF)
105
106-- Iteration 6 --
107float(1856.6929774279)
108
109-- Iteration 7 --
110float(0.00053859200856424)
111
112-- Iteration 8 --
113float(INF)
114
115-- Iteration 9 --
116float(1.0000000037168)
117
118-- Iteration 10 --
119float(4.5055521304275)
120
121-- Iteration 11 --
122float(1)
123
124-- Iteration 12 --
125float(1)
126
127-- Iteration 13 --
128float(20.3)
129
130-- Iteration 14 --
131float(1)
132
133-- Iteration 15 --
134float(20.3)
135
136-- Iteration 16 --
137float(1)
138
139-- Iteration 17 --
140Unsupported operand types: float ** string
141
142-- Iteration 18 --
143Unsupported operand types: float ** string
144
145-- Iteration 19 --
146Unsupported operand types: float ** array
147
148-- Iteration 20 --
149Unsupported operand types: float ** string
150
151-- Iteration 21 --
152Unsupported operand types: float ** string
153
154-- Iteration 22 --
155Unsupported operand types: float ** string
156
157-- Iteration 23 --
158Unsupported operand types: float ** classA
159
160-- Iteration 24 --
161float(1)
162
163-- Iteration 25 --
164float(1)
165
166-- Iteration 26 --
167Unsupported operand types: float ** resource
168