Round with money_format
| From: | Cyril Lopez | Date: | Fri, 16 Sep 2011 14:58:28 +0000 |
| Subject: | Round with money_format | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-314904@lists.php.net to get a copy of this message | ||
Hi,
Can someone help me understand how money_format() rounds numbers ?
<?php
setlocale(LC_ALL, 'fr_FR.UTF-8');
$price = 12.665;
echo money_format('%i',$price);
// 12.66 EUR, 12.67 EUR expected
$price2 = 12.666;
echo money_format('%i',$price2);
// 12.67 EUR, ok
echo round($price,2);
// 12.67, ok
echo round($price2,2);
// 12.67, ok
?>
Misconfiguration ? Bug ?
Thanks !
Cyril
Config :
Debian Lenny, PHP 5.3.8