Rounding

Started by
1 comment, last by Ketay 21 years, 5 months ago
Language: PHP What are the things to round, so like if $iteminfo[cost] == 100; and we were to do: $sellprice = $iteminfo[cost] / 6; How do we do a round UP and a round down, I cant seem to find it in the docs at php.net...... Probably cuz I dunno wht it would be under, but I checked like everything under variables >.< So ya, if anyone could help, please do ^^; -Moo-
-Moo-
Advertisement
Just do some tricks with modulo:

if( $iteminfo[cost] % 6 > 2 )    $sellprice = $iteminfo[cost] / 6 + 1;else    $sellprice = $iteminfo[cost] / 6; 
delete this;
ceil()

This topic is closed to new replies.

Advertisement