Jump to content

[SOLVED] How to round up a number.


overlordofevil

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.