Guest kilbad Posted January 25, 2007 Share Posted January 25, 2007 If I have a variable, let's say $numerator, and I want to divide by a constant number, let's say 4, what PHP command can I use to always round the result up, even if the resulting value is less than .5?So for example: $result = $numerator/4;..in the case that $numerator=1, what could I use to round $result up to 1?Thank you so much in advance!Brendan Link to comment https://forums.phpfreaks.com/topic/35701-solved-if-numerical-variable-is-not-whole-integer-i-want-to-always-round-up/ Share on other sites More sharing options...
Guest kilbad Posted January 25, 2007 Share Posted January 25, 2007 SOLVED:: Ceil Function<?phpecho ceil(4.3); // 5echo ceil(9.999); // 10echo ceil(-3.14); // -3?> Link to comment https://forums.phpfreaks.com/topic/35701-solved-if-numerical-variable-is-not-whole-integer-i-want-to-always-round-up/#findComment-169142 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.