note 32743 added to function.number-format

From: Date: Thu, 05 Jun 2003 18:41:12 +0000
Subject: note 32743 added to function.number-format
Groups: php.notes 
Request: Send a blank email to php-notes+get-49806@lists.php.net to get a copy of this message
I do see that number_format rounds.... your example of $val1 = 1.233; $val2 = 1.235; $val3 = 1.237; echo number_format(al1,2,",",".") . "<BR>"; // returns: 1,23 echo number_format($val2,2,",",".") . "<BR>"; // returns: 1,24 echo number_format($val3,2,",",".") . "<BR>"; // returns: 1,24 does as you specify, however, try inserting $val2 = 1.555 and you end up with 1.55.....is this not rounding correctly? ---- Manual Page -- http://www.php.net/manual/en/function.number-format.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32743 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32743&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32743&report=yes

« previous php.notes (#49806) next »