1--TEST--
2Test floor() - basic function test for floor()
3--INI--
4precision=14
5--FILE--
6<?php
7echo "*** Testing floor() : basic functionality ***\n";
8$values = array(0,
9                -0,
10                0.5,
11                -0.5,
12                1,
13                -1,
14                1.5,
15                -1.5,
16                2.6,
17                -2.6,
18                037,
19                0x5F,
20                "10.5",
21                "-10.5",
22                "3.95E3",
23                "-3.95E3",
24                "039",
25                true,
26                false,
27                null,
28                );
29
30foreach($values as $value) {
31    echo "\n-- floor $value --\n";
32    var_dump(floor($value));
33};
34
35?>
36--EXPECTF--
37*** Testing floor() : basic functionality ***
38
39-- floor 0 --
40float(0)
41
42-- floor 0 --
43float(0)
44
45-- floor 0.5 --
46float(0)
47
48-- floor -0.5 --
49float(-1)
50
51-- floor 1 --
52float(1)
53
54-- floor -1 --
55float(-1)
56
57-- floor 1.5 --
58float(1)
59
60-- floor -1.5 --
61float(-2)
62
63-- floor 2.6 --
64float(2)
65
66-- floor -2.6 --
67float(-3)
68
69-- floor 31 --
70float(31)
71
72-- floor 95 --
73float(95)
74
75-- floor 10.5 --
76float(10)
77
78-- floor -10.5 --
79float(-11)
80
81-- floor 3.95E3 --
82float(3950)
83
84-- floor -3.95E3 --
85float(-3950)
86
87-- floor 039 --
88float(39)
89
90-- floor 1 --
91float(1)
92
93-- floor  --
94float(0)
95
96-- floor  --
97
98Deprecated: floor(): Passing null to parameter #1 ($num) of type int|float is deprecated in %s on line %d
99float(0)
100