karldesign Posted August 20, 2007 Share Posted August 20, 2007 I have the following output from a calculation: 211.5 I want to print this to screen as 211.50 (currency), but the round($value,2) doesn't force a rounding... is it possible? Link to comment https://forums.phpfreaks.com/topic/65789-currency-rounding/ Share on other sites More sharing options...
AndyB Posted August 20, 2007 Share Posted August 20, 2007 http://ca.php.net/manual/en/function.money-format.php Link to comment https://forums.phpfreaks.com/topic/65789-currency-rounding/#findComment-328690 Share on other sites More sharing options...
tibberous Posted August 20, 2007 Share Posted August 20, 2007 $money = explode(".", $money); $money[1] = substr($money[1], 0, 2); $money = $money[0] . "." . (strlen($money[1]) < 1 ? "0" : "") . (strlen($money[1]) < 2 ? "0" : ""); Link to comment https://forums.phpfreaks.com/topic/65789-currency-rounding/#findComment-328694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.