note 37043 added to function.number-format

From: Date: Fri, 31 Oct 2003 18:22:05 +0000
Subject: note 37043 added to function.number-format
Groups: php.notes 
Request: Send a blank email to php-notes+get-59592@lists.php.net to get a copy of this message
a little chain of number_format calls helps to round an amout of money to 5 cent accuracy: it will convert as follows: 8.13 --> 8.15 8.12 --> 8.10 and that's how I did it: $amount = 8.13; echo number_format(number_format($amount*2, 1, '.', '')/2, 2, '.', ''); hope this helps some ohters cheers pascal ---- Manual Page -- http://www.php.net/manual/en/function.number-format.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37043 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37043&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37043&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59592) next »