WarDeities Posted October 7, 2007 Share Posted October 7, 2007 Hey everyone, I have a small problem, I own a game/website called wardeites.com and it is a mmorpg. In this game I have tons of addition/subtraction/division/mulitplication. Anyway...I have some values that are like for example when you pet fights with you in battle it get 10% of the experience you get. $experience=$selmonster3[experience]; $petexperiene=$experience/10; Okay so if the monster give 1251 experience the pet get 125 in the database, but php shows the value of 125.1 is there a way to tell php to not show decimal points to the viewers/players of my game.... I know I can add a new colume in the database for pet experice, but like I said this is but a very small example and I have this problem in a good 200+ places on my game...if anyone knows of a way to get the decimals not to so I'd be very appreciative... Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/72137-solved-tiny-problemgetting-ride-of-decimal-points-when-using-math-in-php/ Share on other sites More sharing options...
cooldude832 Posted October 7, 2007 Share Posted October 7, 2007 sprintf() Quote Link to comment https://forums.phpfreaks.com/topic/72137-solved-tiny-problemgetting-ride-of-decimal-points-when-using-math-in-php/#findComment-363643 Share on other sites More sharing options...
KrisNz Posted October 7, 2007 Share Posted October 7, 2007 intval,floor or ceil Quote Link to comment https://forums.phpfreaks.com/topic/72137-solved-tiny-problemgetting-ride-of-decimal-points-when-using-math-in-php/#findComment-363649 Share on other sites More sharing options...
chocopi Posted October 7, 2007 Share Posted October 7, 2007 dont forget round() Quote Link to comment https://forums.phpfreaks.com/topic/72137-solved-tiny-problemgetting-ride-of-decimal-points-when-using-math-in-php/#findComment-363653 Share on other sites More sharing options...
WarDeities Posted October 7, 2007 Author Share Posted October 7, 2007 Awesome...the round() worked perfectly!!! Thanks a whole lot for they help!!! Quote Link to comment https://forums.phpfreaks.com/topic/72137-solved-tiny-problemgetting-ride-of-decimal-points-when-using-math-in-php/#findComment-363657 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.