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