php货币转换 输出为0 很不明白以下是代码,求高手指点
这是输出:<?php
$total_owners = $record->getNumOwners();
if ($total_owners>0)
for ($i=1; $i<=$total_owners; $i++){
/*if(!is_numeric(ereg_replace("[^0-9/-]", "", $record->owner($i)->getTotalIncome()))){?>
(<?=$i?>) <?=getCurrSymbol($record->getInvestmentAmountCur())?><?=currency_truth_value((int)(substr( $record->owner($i)->getTotalIncome(),0, break_it($record->owner($i)->getTotalIncome()))),$record->owner($i)->getTotalIncomeCur(),$record->getInvestmentAmountCur())?> - 
<?=getCurrSymbol($record->getInvestmentAmountCur())?><?=currency_truth_value((int)(substr( $record->owner($i)->getTotalIncome(),break_it($record->owner($i)->getTotalIncome())+1, strlen($record->owner($i)->getTotalIncome()))),$record->owner($i)->getTotalIncomeCur(),$record->getInvestmentAmountCur())?> 
<?} 
else{*/
$defaultConvertedIncome = $defaultConvertedIncome . "(".$i.") " . getCurrSymbol($record->getInvestmentAmountCur()) . currency_truth_value((ereg_replace("[^0-9]", "", $record->owner($i)->getTotalIncome())),$record->owner($i)->getTotalIncomeCur(),$record->getInvestmentAmountCur()) . " / Month \r";
/*}*/
}
echo $defaultConvertedIncome;
?>
以下是相关函数:
function getCurrSymbol($curr_str){
if ($curr_str == "hkd" ){ return "HKD ";}
elseif ($curr_str == "usd" ){ return "USD ";}
elseif ($curr_str == "gbd" ){ return "GBP ";}
elseif ($curr_str == "eur" ){ return "EUR "; }
elseif ($curr_str == "jpy" ){ return "JPY "; }
else  { return "Currency Error!!";}
}//以上为货币转换,有港币,美元等

// Currency Convertor - Using XE.
function xe_currency_convert($amount, $from, $to)
{
$regex = "/[0-9.]+\s*$from\s*=\s*([0-9.]+)\s*$to/";
$return = file("http://www.xe.net/ucc/convert.cgi?Amount=$amount&From=$from&To=$to");
//die("http://www.xe.net/ucc/convert.cgi?Amount=$amount&From=$from&To=$to");
foreach ($return as $line) {
if( preg_match($regex, $line, $match) ) break;
}
if (!isset($match))
return false;
return ((int)($match[0]*$amount))."/month";
}

function currency_truth_value($totalAmount, $fromCurrency, $toCurrency)
{
if (!is_numeric($totalAmount))
return $totalAmount;
if ($totalAmount <= 0 )
return 0;
elseif ($fromCurrency == $toCurrency)
return $totalAmount;
else
return round((int)(xe_currency_convert($totalAmount, strtoupper($fromCurrency), strtoupper($toCurrency))));
}
求高手指点,或者有类似的给讲讲 问题出在哪里了