You could cast it to an int, although the manual warns that you can get
spurious errors upon casting an unknown fraction, so be careful.
$year= (int) ($years);
Mark
-Original Message-
From: Tom [mailto:[EMAIL PROTECTED]]
Sent: 23 September 2002 15:47
To: [EMAIL PROTECTED]
Subject:
Hi Tom,
Try this:
$years = round($years + ( $themonth / 12 ));
From the manual:
float round ( float val [, int precision])
Returns the rounded value of val to specified precision (number of digits
after the decimal point). precision can also be negative or zero (default).
ceil() and floor()
+ ($themonth / 12) + 0.0001);
---John Holmes...
- Original Message -
From: Support @ Fourthrealm.com [EMAIL PROTECTED]
To: Tom [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, September 23, 2002 11:06 AM
Subject: Re: [PHP] How do i assign Integers only and not real numbers?
Hi Tom,
Try
Subject: Re: [PHP] How do i assign Integers only and not real numbers?
If you end up using floor(), watch for floating point errors. You could
expect your division to come out to a whole number, say 12, but be
represented by 11.999 in the computer. So that'll floor() to 11. You
can add
4 matches
Mail list logo