overlordofevil Posted July 16, 2008 Share Posted July 16, 2008 hey all, This is a basic math question but I can't figure it out. My script is pulling in a numeric data and based on another variable the number is divided in half. Well it works but when it gets an odd number the answer always comes up as 1.5, 3.5, 7.5 etc. So what I am trying to figure out is how to write the math to round up the number. here is part of the code. if ($skillID == '6' && $raceid == '10' || $skillID == '9' && $raceid == '10' ) { $cost=$cost/2; } $cost is set from data pulled from a db table. Any ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/115138-solved-how-to-round-up-a-number/ Share on other sites More sharing options...
sader Posted July 17, 2008 Share Posted July 17, 2008 look at round() ceil() floor() Link to comment https://forums.phpfreaks.com/topic/115138-solved-how-to-round-up-a-number/#findComment-592088 Share on other sites More sharing options...
overlordofevil Posted July 17, 2008 Author Share Posted July 17, 2008 ok I feel stupid for not finding them. thanks for pointing me in the right direction. Link to comment https://forums.phpfreaks.com/topic/115138-solved-how-to-round-up-a-number/#findComment-592097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.