dragonusthei Posted October 4, 2006 Share Posted October 4, 2006 HelloI have built a shopping cart the only problem is that it writes prices like$6.70 as $6.7How can i correct this? Link to comment https://forums.phpfreaks.com/topic/23022-shopping-cart-problem/ Share on other sites More sharing options...
Jocka Posted October 4, 2006 Share Posted October 4, 2006 i'm not too good with the math side of php (at all) but you could probably just check it.list($dollar, $cents) = explode('.', $price); // splits price from dollars and centsif(strlen($cents) == '1'){ $cents .= '0';}something like that would work.. i'm sure theres a more simple way with the math part of php but again, i'm not good with it. Link to comment https://forums.phpfreaks.com/topic/23022-shopping-cart-problem/#findComment-103966 Share on other sites More sharing options...
tleisher Posted October 4, 2006 Share Posted October 4, 2006 You could either use: http://us3.php.net/roundor http://us2.php.net/money_format Link to comment https://forums.phpfreaks.com/topic/23022-shopping-cart-problem/#findComment-103971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.