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