xoluz Posted March 19, 2006 Share Posted March 19, 2006 Hey there!How can I calculate till 2 decimals after the comma?I've got something like this now[code]$price1 = array_sum($prices);$test = $price1 * 0.7;echo $test;[/code]Now I'm getting values like 32.233 or 500.300, but they should be 32,23 and 500,30 :s Quote Link to comment Share on other sites More sharing options...
akitchin Posted March 19, 2006 Share Posted March 19, 2006 round($value, 2)look it up in the manual for more info and similar functions. Quote Link to comment Share on other sites More sharing options...
xoluz Posted March 19, 2006 Author Share Posted March 19, 2006 tnx ill check it out Quote Link to comment Share on other sites More sharing options...
Barand Posted March 19, 2006 Share Posted March 19, 2006 Also, have a look at [a href=\"http://www.php.net/number_format\" target=\"_blank\"]number_format() function[/a]eg[code]$test = 32.4567;echo number_format($test, 2, ',', '');[/code]--> 32,46 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.