BCurrency PHP Class
General description
A fast PHP class to work with google currency converter tool and BNR(National Bank of Romania) official exchange rates for RON (the Romanian currency).
The two main features of the class are : fast access to Google Currency API (not trough the search engine), and very fast access to BNR.ro exchange rates with RON (leu). I say very fast because the class caches the rates into the server's memory, so you don't need to check the BNR feed at every visitor request !
Examples
Google currency convertor
Use the google currency convertor, safe and fast ! The class uses the converter's API and NOT trough the web search conversion, it has only 3 lines of code !
You can use now the google currency with 0 to 4 decimals (max supported by google) !
require ('bcurrency.class.php');
$b_rates = new BCurrency();
$b_rates->google_convert(1,'EUR','USD');//Convert 1 Euro in USD
$b_rates->google_convert(34,'USD','CAD',4);//Convert 34 USD in CAD with 4 decimals
Google supports the following currencies : United Arab Emirates Dirham (AED), Netherlands Antillean Guilder (ANG), Argentine Peso (ARS), Australian Dollar (AUD), Bangladeshi Taka (BDT), Bulgarian Lev (BGN), Bahraini Dinar (BHD), Brunei Dollar (BND), Bolivian Boliviano (BOB), Brazilian Real (BRL), Botswanan Pula (BWP), Canadian Dollar (CAD), Swiss Franc (CHF), Chilean Peso (CLP), Chinese Yuan (CNY), Colombian Peso (COP), Costa Rican Colón (CRC), Czech Republic Koruna (CZK), Danish Krone (DKK), Dominican Peso (DOP), Algerian Dinar (DZD), Estonian Kroon (EEK), Egyptian Pound (EGP), Euro (EUR), Fijian Dollar (FJD), British Pound Sterling (GBP), Hong Kong Dollar (HKD), Honduran Lempira (HNL), Croatian Kuna (HRK), Hungarian Forint (HUF), Indonesian Rupiah (IDR), Israeli New Sheqel (ILS), Indian Rupee (INR), Jamaican Dollar (JMD), Jordanian Dinar (JOD), Japanese Yen (JPY), Kenyan Shilling (KES), South Korean Won (KRW), Kuwaiti Dinar (KWD), Cayman Islands Dollar (KYD), Kazakhstani Tenge (KZT), Lebanese Pound (LBP), Sri Lankan Rupee (LKR), Lithuanian Litas (LTL), Latvian Lats (LVL), Moroccan Dirham (MAD), Moldovan Leu (MDL), Macedonian Denar (MKD), Mauritian Rupee (MUR), Maldivian Rufiyaa (MVR), Mexican Peso (MXN), Malaysian Ringgit (MYR), Namibian Dollar (NAD), Nigerian Naira (NGN), Nicaraguan Córdoba (NIO), Norwegian Krone (NOK), Nepalese Rupee (NPR), New Zealand Dollar (NZD), Omani Rial (OMR), Peruvian Nuevo Sol (PEN), Papua New Guinean Kina (PGK), Philippine Peso (PHP), Pakistani Rupee (PKR), Polish Zloty (PLN), Paraguayan Guarani (PYG), Qatari Rial (QAR), Romanian Leu (RON), Serbian Dinar (RSD), Russian Ruble (RUB), Saudi Riyal (SAR), Seychellois Rupee (SCR), Swedish Krona (SEK), Singapore Dollar (SGD), Slovak Koruna (SKK), Sierra Leonean Leone (SLL), Salvadoran Colón (SVC), Thai Baht (THB), Tunisian Dinar (TND), Turkish Lira (TRY), Trinidad and Tobago Dollar (TTD), New Taiwan Dollar (TWD), Tanzanian Shilling (TZS), Ukrainian Hryvnia (UAH), Ugandan Shilling (UGX), US Dollar (USD), Uruguayan Peso (UYU), Uzbekistan Som (UZS), Venezuelan Bolívar (VEF), Vietnamese Dong (VND), CFA Franc BCEAO (XOF), Yemeni Rial (YER), South African Rand (ZAR), Zambian Kwacha (ZMK)
National Bank of Romania (BNR.ro) functions
$b_rates->bnr_convert(249,'RON','HUF');//Convert 249 RON in forints, with 1 decimal (default)
$b_rates->bnr_convert(100,'RON','EUR',3);//100 RON in Euro, with 3 decimals.
If you want to use this class just to display the currency rates (and not convert), just use this function :
$b_rates->get_bnr_currency('CAD');//returns single rate : (float) 3
$b_rates->get_bnr_currency(array('USD','CAD','EUR')); //returns multiple rates : Array ( [USD] => 2.96 [CAD] => 3 [EUR] => 4.26 )
BNR convertor function supports FROM or TO RON : AED,AUD,BGN,BRL, CAD, CHF,CNY, CZK,DKK, EGP,EUR, GBP,HUF, INR,JPY ,KRW,MDL ,MXN,NOK ,NZD,PLN, RSD,RUB, SEK,TRY, UAH,USD, XAU,XDR, ZAR
Note all results are float type, or bool (false) if something went wrong.
You will find more examples and documentation in the class archive !!
Download current version
Get the latest version from google code http://code.google.com/p/bcurrency/
Change log
Nothing yet
Bugs and requests
Please post a comment here on the google project page if
- You like this class !
- You use (used or will use) this class
- Found a bug
- Want a feature request
- Just want to give a suggestion (how to improve my code)
Thanks !
Tags :
php,class,currency, RON, leu,lei, USD, EUR,convertor
By .(JavaScript must be enabled to view this email address) • Tagged #Free Software #Open source PHP classes • Written August 22 2011 • So far it has 219 views and 1 Comments • Permalink •

Gentlemen, reviewing coitus ads often wonderment what would be more safely a improved for them. Of seminar, in terms of taste, what to erotica, which is not too much to discuss. We separate that you give birth to to select what feels good. And certainly, looking at <a >Spotkania towarzyskie</a>, you requirement first it was charmed into account. Anyway, there remains the question of age. The most prevailing sexual intercourse without a suspect thirties and immature girls. Numberless men cudgel one’s brains, what more advisedly to determine as they through making love ads. On the harmonious aid, every valet provoke young girls. Manner, multifarious people wonder whether you solid their skills are so gargantuan that they be traceable full satisfaction. On the other hand, we have copulation thirty. A little older, but definitely, even more young. Incredibly, what is impressive, these women already have some episode of life, they grasp what they like men themselves also know each other. And in this manner, likely know how to hand out pleasure. Nowadays, on the other hand, as a rule know darned genially that young girls, not just the older ones. It is worth reviewing copulation ads also check tick off what is nearby on a lady, and the figure that we make have to settle as a replacement for a one hour meeting or a dusk (which is very likely much more high-priced option). In support of many, it inclination also be important whether you put on the market expertise trips, or right-minded a convergence at its premises.
Posted by esopsType 01/09 04:21 PM