PHP国家代码到HTML货币符号列表

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP国家代码到HTML货币符号列表相关的知识,希望对你有一定的参考价值。

This took me a while to create so thought I would share. Can be used with <a href="http://www.textfixer.com/resources/country-dropdowns.php">html dropdown lists</a>.
  1. function country_currency( $amount = 0 ) {
  2. $bc = ''; // Set this to your country
  3. $currency_before = '';
  4. $currency_after = '';
  5.  
  6. if( $bc == 'GB' || $bc == 'IE' || $bc == 'CY' ) $currency_before = '&pound;';
  7. if( $bc == 'AT' || $bc == 'BE' || $bc == 'FI' || $bc == 'FR' ||
  8. $bc == 'DE' || $bc == 'GR' || $bc == 'GP' || $bc == 'IT' ||
  9. $bc == 'LU' || $bc == 'NL' || $bc == 'PT' || $bc == 'SI' ||
  10. $bc == 'ES') $currency_before = '&euro;';
  11. if( $bc == 'BR' ) $currency_before = 'R$';
  12. if( $bc == 'CN' || $bc == 'JP' ) $currency_before = '&yen;';
  13. if( $bc == 'CR' ) $currency_before = '&cent;';
  14. if( $bc == 'HR' ) $currency_after = ' kn';
  15. if( $bc == 'CZ' ) $currency_after = ' kc';
  16. if( $bc == 'DK' ) $currency_before = 'DKK ';
  17. if( $bc == 'EE' ) $currency_after = ' EEK';
  18. if( $bc == 'HK' ) $currency_before = 'HK$';
  19. if( $bc == 'HU' ) $currency_after = ' Ft';
  20. if( $bc == 'IS' || $bc == 'SE' ) $currency_after = ' kr';
  21. if( $bc == 'IN' ) $currency_before = 'Rs. ';
  22. if( $bc == 'ID' ) $currency_before = 'Rp. ';
  23. if( $bc == 'IL' ) $currency_after = ' NIS';
  24. if( $bc == 'LV' ) $currency_before = 'Ls ';
  25. if( $bc == 'LT' ) $currency_after = ' Lt';
  26. if( $bc == 'MY' ) $currency_before = 'RM';
  27. if( $bc == 'MT' ) $currency_before = 'Lm';
  28. if( $bc == 'NO' ) $currency_before = 'kr ';
  29. if( $bc == 'PH' ) $currency_before = 'PHP';
  30. if( $bc == 'PL' ) $currency_after = ' z';
  31. if( $bc == 'RO' ) $currency_after = ' lei';
  32. if( $bc == 'RU' ) $currency_before = 'RUB';
  33. if( $bc == 'SK' ) $currency_after = ' Sk';
  34. if( $bc == 'ZA' ) $currency_before = 'R ';
  35. if( $bc == 'KR' ) $currency_before = 'W';
  36. if( $bc == 'CH' ) $currency_before = 'SFr. ';
  37. if( $bc == 'SY' ) $currency_after = ' SYP';
  38. if( $bc == 'TH' ) $currency_after = ' Bt';
  39. if( $bc == 'TT' ) $currency_before = 'TT$';
  40. if( $bc == 'TR' ) $currency_after = ' TL';
  41. if( $bc == 'AE' ) $currency_before = 'Dhs. ';
  42. if( $bc == 'VE' ) $currency_before = 'Bs. ';
  43.  
  44. if( $currency_before == '' && $currency_after == '' ) $currency_before = '$';
  45.  
  46. return $currency_before . number_format( $amount, 2 ) . $currency_after;
  47. }

以上是关于PHP国家代码到HTML货币符号列表的主要内容,如果未能解决你的问题,请参考以下文章

sql 具有iso代码,拨号代码,货币名称,货币符号和货币代码的国家/地区列表

text SQL中具有货币(ISO代码和符号)格式的国家/地区列表。

根据国家/地区获取货币符号

php [WooCommerce货币转换器小部件]使用国家标志而不是国家代码。

货币符号的 Web 服务

国际化之货币符号显示