1--TEST-- 2Test floor() - basic function test for floor() 3--INI-- 4precision=14 5--FILE-- 6<?php 7/* Prototype : float floor ( float $value ) 8 * Description: Round fractions down. 9 * Source code: ext/standard/math.c 10 */ 11 12echo "*** Testing floor() : basic functionality ***\n"; 13$values = array(0, 14 -0, 15 0.5, 16 -0.5, 17 1, 18 -1, 19 1.5, 20 -1.5, 21 2.6, 22 -2.6, 23 037, 24 0x5F, 25 "10.5", 26 "-10.5", 27 "3.95E3", 28 "-3.95E3", 29 "039", 30 true, 31 false, 32 null, 33 ); 34 35foreach($values as $value) { 36 echo "\n-- floor $value --\n"; 37 var_dump(floor($value)); 38}; 39 40?> 41===Done=== 42--EXPECT-- 43*** Testing floor() : basic functionality *** 44 45-- floor 0 -- 46float(0) 47 48-- floor 0 -- 49float(0) 50 51-- floor 0.5 -- 52float(0) 53 54-- floor -0.5 -- 55float(-1) 56 57-- floor 1 -- 58float(1) 59 60-- floor -1 -- 61float(-1) 62 63-- floor 1.5 -- 64float(1) 65 66-- floor -1.5 -- 67float(-2) 68 69-- floor 2.6 -- 70float(2) 71 72-- floor -2.6 -- 73float(-3) 74 75-- floor 31 -- 76float(31) 77 78-- floor 95 -- 79float(95) 80 81-- floor 10.5 -- 82float(10) 83 84-- floor -10.5 -- 85float(-11) 86 87-- floor 3.95E3 -- 88float(3950) 89 90-- floor -3.95E3 -- 91float(-3950) 92 93-- floor 039 -- 94float(39) 95 96-- floor 1 -- 97float(1) 98 99-- floor -- 100float(0) 101 102-- floor -- 103float(0) 104===Done=== 105