note 16308 added to function.intval
| From: | mjbraca at NOSPAM dot hotmail dot com | Date: | Wed, 24 Oct 2001 13:46:06 +0000 |
| Subject: | note 16308 added to function.intval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-19373@lists.php.net to get a copy of this message | ||
wls@wwco.com wrote:
> If you want rounding....
> $result = intval( round( $value + 0.5 ) );
But that is not correct, because round() adds the 0.5 for you. Either of the following would work:
$result = intval( $value + 0.5 );
$result = intval( round( $value ) );
--
http://www.php.net/manual/en/function.intval.php
http://master.php.net/manage/user-notes.php?action=edit+16308
http://master.php.net/manage/user-notes.php?action=delete+16308
http://master.php.net/manage/user-notes.php?action=reject+16308