Skip to content
Advertisement

Tag: rounding

How to round an integer UP to the nearest 15 in PHP

I have the INTEGER(255) variable $duration stored with a value taken from the user. I need to round this UP to the nearest 15. I have searched all over but haven’t been able to find a solution. How may I go about doing this? For example: 10 becomes 15 16 becomes 30 130 becomes 135 Also, how can I add

Round datetime to last hour

I tried to look for this but I could not find good example of this what im trying to do. I got datetime values in MySQL database that has to be rounded down when that value is on use. Example, all …

PHP Undefined Constant PHP_ROUND_HALF_DOWN

I have some PHP code in a project I’m working on that uses PHP’s round function. On my localhost, I don’t include any quotes around my mode argument, stating it as just PHP_ROUND_HALF_DOWN. However, when pushing to my server I get the error message: Now, when I add the single quotes to the mode argument, the first error goes away,

Advertisement