note 12808 deleted from function.intval by jimw

From: Date: Wed, 24 Oct 2001 20:44:12 +0000
Subject: note 12808 deleted from function.intval by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19399@lists.php.net to get a copy of this message
As pointed out before, intval( 1.9 ) is 1 ...not 2! Intval() is performing TRUNCATION. If you want rounding, then use the round() function. For example round( $value + 0.5) will work, however it produces a double. Thus the following gets what you want in a roundabout way: $result = intval( round( $value + 0.5 ) );

« previous php.notes (#19399) next »