ID: 25689 Comment by: tuxedobob at mac dot com Reported By: php at pgregg dot com Status: Open Bug Type: Feature/Change Request Operating System: All PHP Version: Irrelevant New Comment:
Agreed, but... It would be nice if ceil() and floor() had a precision parameter similar to that of round(), such that: floor(3.14159, 2) = 3.14 ceil(3.14159, 2) = 3.15 Previous Comments: ------------------------------------------------------------------------ [2003-09-29 09:27:25] php at pgregg dot com Description: ------------ RFE: modify ceil/floor functions so that they take a second optional argument (default 1) that is the factor to which the number is rounded up or down? e.g. you want to round up to the nearest 50? $x = ceil($y, 50); currently you'd have to do: $x = intval(($y+49)/50)*50; This would retain backward compatibility with all code as the default value of 1 would mean that behaviour was the same. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25689&edit=1