1--TEST--
2Test ceil() function : usage variations - different data types as $value arg
3--INI--
4precision=14
5--FILE--
6<?php
7echo "*** Testing ceil() : usage variations ***\n";
8//get an unset variable
9$unset_var = 10;
10unset ($unset_var);
11
12// get a class
13class classA
14{
15}
16
17// heredoc string
18$heredoc = <<<EOT
19abc
20xyz
21EOT;
22
23// get a resource variable
24$fp = fopen(__FILE__, "r");
25
26// unexpected values to be passed to $value argument
27$inputs = array(
28       // null data
29/* 1*/ NULL,
30       null,
31
32       // boolean data
33/* 3*/ true,
34       false,
35       TRUE,
36       FALSE,
37
38       // empty data
39/* 7*/ "",
40       '',
41       array(),
42
43       // string data
44/*10*/ "abcxyz",
45       'abcxyz}',
46       $heredoc,
47
48       // object data
49/*13*/ new classA(),
50
51       // undefined data
52/*14*/ @$undefined_var,
53
54       // unset data
55/*15*/ @$unset_var,
56
57       // resource variable
58/*16*/ $fp
59);
60
61// loop through each element of $inputs to check the behaviour of ceil()
62$iterator = 1;
63foreach($inputs as $input) {
64    echo "\n-- Iteration $iterator --\n";
65    try {
66        var_dump(ceil($input));
67    } catch (TypeError $e) {
68        echo $e->getMessage(), "\n";
69    }
70    $iterator++;
71};
72fclose($fp);
73?>
74--EXPECT--
75*** Testing ceil() : usage variations ***
76
77-- Iteration 1 --
78float(0)
79
80-- Iteration 2 --
81float(0)
82
83-- Iteration 3 --
84float(1)
85
86-- Iteration 4 --
87float(0)
88
89-- Iteration 5 --
90float(1)
91
92-- Iteration 6 --
93float(0)
94
95-- Iteration 7 --
96ceil(): Argument #1 ($num) must be of type int|float, string given
97
98-- Iteration 8 --
99ceil(): Argument #1 ($num) must be of type int|float, string given
100
101-- Iteration 9 --
102ceil(): Argument #1 ($num) must be of type int|float, array given
103
104-- Iteration 10 --
105ceil(): Argument #1 ($num) must be of type int|float, string given
106
107-- Iteration 11 --
108ceil(): Argument #1 ($num) must be of type int|float, string given
109
110-- Iteration 12 --
111ceil(): Argument #1 ($num) must be of type int|float, string given
112
113-- Iteration 13 --
114ceil(): Argument #1 ($num) must be of type int|float, classA given
115
116-- Iteration 14 --
117float(0)
118
119-- Iteration 15 --
120float(0)
121
122-- Iteration 16 --
123ceil(): Argument #1 ($num) must be of type int|float, resource given
124