Project MoneyConv (CleanView - Demo - Download)
MoneyConv is a very useful and fast currency converter. It gets the latest updated exchage rates directly from the European Central Bank's website, and allows you to convert any world-wide currency to another. It supports also local caching which ensures you better performance and more data availablity.
var $accuracy = 3; //<- decimal numbers after dot (3 means 12,345)
var $currMode=3; //<- 1:'GBP' / 2:'British Pound' / 2:'(GBP) British Pound '
var $update= 2; //<- cache updating interval (in hours)
var $cache=true; //<- allow file caching for FASTER loading
var $cacheFile='cache/MCache.txt'; //<- cache file (chmod 755)
Useful methods:
« Back
Description
MoneyConv is a very useful and fast currency converter. It gets the latest updated exchage rates directly from the European Central Bank's website, and allows you to convert any world-wide currency to another. It supports also local caching which ensures you better performance and more data availablity.
Docs
Config vars (beginning of the Class):var $accuracy = 3; //<- decimal numbers after dot (3 means 12,345)
var $currMode=3; //<- 1:'GBP' / 2:'British Pound' / 2:'(GBP) British Pound '
var $update= 2; //<- cache updating interval (in hours)
var $cache=true; //<- allow file caching for FASTER loading
var $cacheFile='cache/MCache.txt'; //<- cache file (chmod 755)
Useful methods:
- @int convert($amount,$from,$to) :: convert $amount from $from to $to currency
(example: convert('10','USD','EUR') //output: ~7.824)
(usage: echo $money->convert (33,'USD','EUR');) - @Array getCurrencyList ($mode=1) :: returns currecy array formatted with '$mode' syntax (1:GBP /2:British pound /3:(GBP) British pound)
(example: getCurrencyList() //output: array(AUD, BGN, ....))
(usage: foreach ($money->getCurrencyList(3) as $k=>$v) echo "$v\n";) - @String getConversionList($base='EUR') :: returns the conversion rates for each currency against '$base' currency
(example: getConversionList() //output: array(AUD=>1.726, BGN=>1.955, ....))
(usage: foreach ($money->getConversionList() as $k=>$v) echo " $k->$v\n";) - @String getUpdateTime() :: exchange rates last update date (format= YYYY-MM-DD)
(example: getUpdateTime() //output: 2006-06-07)
(usage: echo $money->getUpdateTime();) - @String getCurrencyChart($c) :: returns currency chart (last 365 days)
(example: getCurrencyChart('EUR') //output: <img src="..." alt="..." />)
(usage: echo $money->getCurrencyChart('EUR');) - @String currency($c,$mode='') :: format currency code with '$mode' syntax (1:GBP /2:British pound /3:British pound (GBP))
(example: currency('USD',2) //output: US Dollar)
(usage: echo $money->currency('USD',2);)
D
O
C
S
O
C
S
<?phpinclude 'MoneyConv.php';$money= new MoneyConv();$amount='99.90';$from='EUR';$to='CHF';echo $amount.' ('.$money->currency($from,1).') = ';echo $money->convert ($amount,$from,$to);echo ' ('.$money->currency($to,1).') <br>';echo ' (exchange rates updated on '.$money->getUpdateTime().')<br>';?>
« Back