|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #25689 RFE for: ceil() floor() functions
Submitted: 2003-09-29 09:27 UTC Modified: 2010-11-19 01:09 UTC
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: php at pgregg dot com Assigned: jani (profile)
Status: Closed Package: Math related
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2003-09-29 09:27 UTC] php at pgregg dot com
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-06 23:06 UTC] tuxedobob at mac dot com
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
 [2010-11-18 23:38 UTC]
-Package: Feature/Change Request +Package: Math related -Operating System: All +Operating System: * -PHP Version: Irrelevant +PHP Version: *
 [2010-11-19 01:09 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: jani
 [2010-11-19 01:09 UTC]
Same as bug #23498
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 01:01:29 2024 UTC