phprookie72 Posted February 9, 2012 Share Posted February 9, 2012 is there a math function that give you an integer value when u divide 2 numbers? ie in 7/3 i just want 2 as a result not floating number. thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/256750-math-function/ Share on other sites More sharing options...
smerny Posted February 9, 2012 Share Posted February 9, 2012 would floor() do what you want? http://php.net/manual/en/function.floor.php Quote Link to comment https://forums.phpfreaks.com/topic/256750-math-function/#findComment-1316194 Share on other sites More sharing options...
AyKay47 Posted February 9, 2012 Share Posted February 9, 2012 depends, do you want the float to round up if it is .5 or greater? e.g. a divided value of 3.5 would return 4. Quote Link to comment https://forums.phpfreaks.com/topic/256750-math-function/#findComment-1316197 Share on other sites More sharing options...
ManiacDan Posted February 9, 2012 Share Posted February 9, 2012 You want either floor() or round() (note that ceil() also exists) Quote Link to comment https://forums.phpfreaks.com/topic/256750-math-function/#findComment-1316199 Share on other sites More sharing options...
phprookie72 Posted February 9, 2012 Author Share Posted February 9, 2012 thank you floor() will do what i want. Quote Link to comment https://forums.phpfreaks.com/topic/256750-math-function/#findComment-1316250 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.