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: [PHP] How do i assign Integers only and not real numbers?


Hi all,

I have a line of code that assigns a new year number: -

$years = $years + ( $themonth / 12 );

but sometimes $years == 1998.0833333333

or

$year == 2002.75

etc...

I cant find anything like a round() or floor() function in PHP so that year
would be 1998 or 2002 only.

Does anyone know what function would do this?  Sorry if I`m wasting your
time if its a really obvious one!

thanks in advance,
Tom



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to