I want to round-off the value of a variable upto 2 decimal points,as i am converting indian rupees to dollar....
It is giving dollar value in long decimal digits which cannt be used in paypal or something like that..
Here is the code which i am using to convert the money from INR to Dollar..
Code: Select all
$amount=get_order_total(); // Amount to convert
$from = 'INR'; //US Dollar - currency to be converted
$to = 'USD'; //to INDIAN RUPEES - result currency
$url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X';
$handle = @fopen($url, 'r');
if ($handle) {
$result = fgets($handle, 4096);
fclose($handle);
}
$array = explode(',',$result);
$RS_value=$array[1];
$rs_amount=$amount*$RS_value;
//echo $rs_amount ;
?>
If you have any idea how to round off this value ..please post it.
regards
Amit