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 "0x5F", 31 true, 32 false, 33 null, 34 ); 35 36foreach($values as $value) { 37 echo "\n-- floor $value --\n"; 38 var_dump(floor($value)); 39}; 40 41?> 42===Done=== 43--EXPECTF-- 44*** Testing floor() : basic functionality *** 45 46-- floor 0 -- 47float(0) 48 49-- floor 0 -- 50float(0) 51 52-- floor 0.5 -- 53float(0) 54 55-- floor -0.5 -- 56float(-1) 57 58-- floor 1 -- 59float(1) 60 61-- floor -1 -- 62float(-1) 63 64-- floor 1.5 -- 65float(1) 66 67-- floor -1.5 -- 68float(-2) 69 70-- floor 2.6 -- 71float(2) 72 73-- floor -2.6 -- 74float(-3) 75 76-- floor 31 -- 77float(31) 78 79-- floor 95 -- 80float(95) 81 82-- floor 10.5 -- 83float(10) 84 85-- floor -10.5 -- 86float(-11) 87 88-- floor 3.95E3 -- 89float(3950) 90 91-- floor -3.95E3 -- 92float(-3950) 93 94-- floor 039 -- 95float(39) 96 97-- floor 0x5F -- 98float(95) 99 100-- floor 1 -- 101float(1) 102 103-- floor -- 104float(0) 105 106-- floor -- 107float(0) 108===Done===