RE: [PHP] How do i assign Integers only and not real numbers?

2002-09-23 Thread M . A . Bond
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:

Re: [PHP] How do i assign Integers only and not real numbers?

2002-09-23 Thread Support @ Fourthrealm.com
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()

Re: [PHP] How do i assign Integers only and not real numbers?

2002-09-23 Thread 1LT John W. Holmes
+ ($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

RE: [PHP] How do i assign Integers only and not real numbers?

2002-09-23 Thread Tom Callaghan
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