...

View Full Version : Using /2 coming up with decimals?



masterofollies
01-26-2008, 08:12 PM
I have a problems. If I divide a number in half and it's not even, it gives me decimals. Like this

$points = 5;
$newpoints = $member["points"]/2;

Your new points are $newpoints

Which comes up as 2.5

I didn't write it the same way, but I am sure you understand. How can I get it to exclude decimals and round to the next number? So it would be a 2 or 3 ?

kbluhm
01-26-2008, 08:25 PM
http://www.php.net/round

masterofollies
01-26-2008, 08:27 PM
That link doesn't work

kbluhm
01-26-2008, 10:03 PM
Ok, common sense tell you that the link is to php.net. The site seems to be down.

So, once you are able to get to php.net, search for the round() function.

Or, try a mirror:
http://us2.php.net/round
http://us3.php.net/round

Or, let me just tell you: use round()



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum