...

View Full Version : Simple number problem



Taipan
03-31-2004, 11:20 PM
Another basic question .. I need to divide a number by 5 and I want to trim anything after a decimal point in the answer. eg 18 / 5 = 3.6. I want the make the answer 3. Is there a simple way to do this?

sad69
03-31-2004, 11:58 PM
There are a few different things you can do:
25/7 // float(3.5714285714286)
(int) (25/7) // int(3)
round(25/7) // float(4)

I got this from:
http://php.oregonstate.edu/manual/en/language.types.integer.php

Hope that helps,
Sadiq.

sidney
04-01-2004, 12:30 AM
try floor();

Taipan
04-01-2004, 01:38 AM
excellent ... floor() does it nicely, thanks. :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum