Some time you need to get html entity of currency code so
I
would like to share with you a smart method you just need to add below method in
your project,
It includes major famous country code or you can add it more hope
so that will work fine for you J
/* get html entity of currency symboles */
function GetCurrencySymbol($cc = 'USD')
{
$cc = strtoupper($cc);
$currency = array(
"USD" => "$" , //U.S. Dollar
"AUD" => "$" , //Australian Dollar
"BRL" => "R$" , //Brazilian Real
"CAD" => "C$" , //Canadian Dollar
"CZK" => "Kč" , //Czech Koruna
"DKK" => "kr" , //Danish Krone
"EUR" => "€" , //Euro
"HKD" => "$" , //Hong Kong Dollar
"HUF" => "Ft" , //Hungarian Forint
"ILS" => "₪" , //Israeli New Sheqel
"INR" => "₹" //Indian Rupee
"JPY" => "¥" , //Japanese Yen
"MYR" => "RM" , //Malaysian Ringgit
"MXN" => "$" , //Mexican Peso
"NOK" => "kr" , //Norwegian Krone
"NZD" => "$" , //New Zealand Dollar
"PHP" => "₱" , //Philippine Peso
"PLN" => "zł" ,//Polish Zloty
"GBP" => "£" , //Pound Sterling
"SEK" => "kr" , //Swedish Krona
"CHF" => "Fr" , //Swiss Franc
"TWD" => "$" , //Taiwan New Dollar
"THB" => "฿" , //Thai Baht
"TRY" => "₺" //Turkish Lira
);
if(array_key_exists($cc, $currency)){
return $currency[$cc];
}
}
Usage
GetCurrencySymbol(“CAD”);
No comments:
Post a Comment