Nick11380 Posted September 7, 2011 Share Posted September 7, 2011 I'm really struggling to see how to do this. The following number is being posted: As of <span id="theTime"></span> GMT, the gold price per ounce</a> in the UK is £'.$results['ounce_price']; I want 'ounce_price' to be rounded to decimal places but can't figure how to do this. Does 'round($results,2) ' mean anything in this situation? Where can I place the code. I'm a little confused, any help would be hugely appreciated! Quote Link to comment Share on other sites More sharing options...
silkfire Posted September 7, 2011 Share Posted September 7, 2011 Nick, you're right! echo 'As of <span id="theTime"></span> GMT, the gold price per ounce</a> in the UK is £' . round($results['ounce_price'], 2) . '.'; Quote Link to comment Share on other sites More sharing options...
Nick11380 Posted September 7, 2011 Author Share Posted September 7, 2011 Simple! Thank you very much buddy, much appreciated! Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 7, 2011 Share Posted September 7, 2011 sprintf http://php.net/manual/en/function.sprintf.php echo "£".sprintf('%.2f',$results['ounce_price']); 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.