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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.