1--TEST--
2Test pow() function : usage variations - different data types as $base argument
3--INI--
4precision = 14
5--SKIPIF--
6<?php
7if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
8?>
9--FILE--
10<?php
11/* Prototype  : number pow  ( number $base  , number $exp  )
12 * Description: Exponential expression.
13 * Source code: ext/standard/math.c
14 */
15
16echo "*** Testing pow() : usage variations ***\n";
17
18//get an unset variable
19$unset_var = 10;
20unset ($unset_var);
21
22// heredoc string
23$heredoc = <<<EOT
24abc
25xyz
26EOT;
27
28// get a class
29class classA
30{
31}
32
33// get a resource variable
34$fp = fopen(__FILE__, "r");
35
36$inputs = array(
37       // int data
38/*1*/  0,
39       1,
40       12345,
41       -2345,
42       PHP_INT_MAX,
43
44       // float data
45/*6*/  10.5,
46       -10.5,
47       12.3456789000e10,
48       12.3456789000E-10,
49       .5,
50
51       // null data
52/*11*/ NULL,
53       null,
54
55       // boolean data
56/*13*/ true,
57       false,
58       TRUE,
59       FALSE,
60
61       // empty data
62/*17*/ "",
63       '',
64       array(),
65
66       // string data
67/*20*/ "abcxyz",
68       'abcxyz',
69       $heredoc,
70
71       // object data
72/*23*/ new classA(),
73
74       // undefined data
75/*24*/ @$undefined_var,
76
77       // unset data
78/*25*/ @$unset_var,
79
80       // resource variable
81/*26*/ $fp
82);
83
84// loop through each element of $inputs to check the behaviour of pow()
85$iterator = 1;
86foreach($inputs as $input) {
87	echo "\n-- Iteration $iterator --\n";
88	var_dump(pow($input, 3));
89	$iterator++;
90};
91fclose($fp);
92?>
93===Done===
94--EXPECTF--
95*** Testing pow() : usage variations ***
96
97-- Iteration 1 --
98int(0)
99
100-- Iteration 2 --
101int(1)
102
103-- Iteration 3 --
104float(1881365963625)
105
106-- Iteration 4 --
107float(-12895213625)
108
109-- Iteration 5 --
110float(9.903520300448E+27)
111
112-- Iteration 6 --
113float(1157.625)
114
115-- Iteration 7 --
116float(-1157.625)
117
118-- Iteration 8 --
119float(1.881676371789%dE+33)
120
121-- Iteration 9 --
122float(1.881676371789%dE-27)
123
124-- Iteration 10 --
125float(0.125)
126
127-- Iteration 11 --
128int(0)
129
130-- Iteration 12 --
131int(0)
132
133-- Iteration 13 --
134int(1)
135
136-- Iteration 14 --
137int(0)
138
139-- Iteration 15 --
140int(1)
141
142-- Iteration 16 --
143int(0)
144
145-- Iteration 17 --
146
147Warning: A non-numeric value encountered in %s on line %d
148int(0)
149
150-- Iteration 18 --
151
152Warning: A non-numeric value encountered in %s on line %d
153int(0)
154
155-- Iteration 19 --
156int(0)
157
158-- Iteration 20 --
159
160Warning: A non-numeric value encountered in %s on line %d
161int(0)
162
163-- Iteration 21 --
164
165Warning: A non-numeric value encountered in %s on line %d
166int(0)
167
168-- Iteration 22 --
169
170Warning: A non-numeric value encountered in %s on line %d
171int(0)
172
173-- Iteration 23 --
174
175Notice: Object of class classA could not be converted to int in %s on line %d
176int(1)
177
178-- Iteration 24 --
179int(0)
180
181-- Iteration 25 --
182int(0)
183
184-- Iteration 26 --
185%s
186===Done===
187