Possible Duplicate:
PHP number format
The following code out puts a figure for shipping cost based on a currency conversion that happens elsehwere, but it outputs with many decimal places. Can I alter something here that will produce a number with just 2 decimal places?
if(isset($_POST['ShippingMethod'])){
$order['data'] .= "\r\n ========== Shipping Cost ========== \r\n\r";
$order['data'] .="\r\n Shipping Method Cost: ". $_SESSION['currency_symbol'].$_POST['ShippingMethod']. " \r\n";
$form['price']['shipping'] +=$_POST['ShippingMethod'];
}
have a look at http://php.net/number_format and if its related to currency, check out http://php.net/manual/en/function.money-format.php
精彩评论