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)??? Quote Link to comment 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] Quote Link to comment 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] Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Barand Posted November 19, 2006 Share Posted November 19, 2006 try echo number_format($k, 3); 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.