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!!! 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() 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 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() 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!!! 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
Archived
This topic is now archived and is closed to further replies.