mcmuney Posted November 19, 2006 Share Posted November 19, 2006 How would I take a result, divide by a numbers and display the result with 3 decimal places (1.004)??? Link to comment https://forums.phpfreaks.com/topic/27741-using-calculations/ Share on other sites More sharing options...
trq Posted November 19, 2006 Share Posted November 19, 2006 [code=php:0]$final = $result / $number;echo format_number($final,3);[/code] Link to comment https://forums.phpfreaks.com/topic/27741-using-calculations/#findComment-126918 Share on other sites More sharing options...
mcmuney Posted November 19, 2006 Author Share Posted November 19, 2006 I'm getting an error with this:[code]<? $k = $arr_coins / 100; echo format_number($k,3);?>[/code]This alone displays the number that I'm trying to divide:[code]<? echo $arr_coins;?>[/code] Link to comment https://forums.phpfreaks.com/topic/27741-using-calculations/#findComment-126954 Share on other sites More sharing options...
marcus Posted November 19, 2006 Share Posted November 19, 2006 Put some whitespace in there.[code]<?php$k = "$arr_coins / 100";echo formatnumber($k,3);echo $arr_coins;?>[/code] Link to comment https://forums.phpfreaks.com/topic/27741-using-calculations/#findComment-126971 Share on other sites More sharing options...
Barand Posted November 19, 2006 Share Posted November 19, 2006 try echo number_format($k, 3); Link to comment https://forums.phpfreaks.com/topic/27741-using-calculations/#findComment-127004 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.