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 != 8) die("skip this test is for 64bit 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 --
104int(1881365963625)
105
106-- Iteration 4 --
107int(-12895213625)
108
109-- Iteration 5 --
110float(7.8463771692334E+56)
111
112-- Iteration 6 --
113float(1157.625)
114
115-- Iteration 7 --
116float(-1157.625)
117
118-- Iteration 8 --
119float(1.8816763717892E+33)
120
121-- Iteration 9 --
122float(1.8816763717892E-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 --
146int(0)
147
148-- Iteration 18 --
149int(0)
150
151-- Iteration 19 --
152int(0)
153
154-- Iteration 20 --
155int(0)
156
157-- Iteration 21 --
158int(0)
159
160-- Iteration 22 --
161int(0)
162
163-- Iteration 23 --
164
165Notice: Object of class classA could not be converted to int in %s on line %d
166int(1)
167
168-- Iteration 24 --
169int(0)
170
171-- Iteration 25 --
172int(0)
173
174-- Iteration 26 --
175%s
176===Done===
177