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

Posted

tags:

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

function country_currency( $amount = 0 ) {
    $bc = ''; // Set this to your country
    $currency_before = '';
    $currency_after = '';
    
    if( $bc == 'GB' || $bc == 'IE' || $bc == 'CY' ) $currency_before = '£';
    if( $bc == 'AT' || $bc == 'BE' || $bc == 'FI' || $bc == 'FR' || 
        $bc == 'DE' || $bc == 'GR' || $bc == 'GP' || $bc == 'IT' ||
        $bc == 'LU' || $bc == 'NL' || $bc == 'PT' || $bc == 'SI' ||
        $bc == 'ES') $currency_before = '€';
    if( $bc == 'BR' ) $currency_before = 'R$';
    if( $bc == 'CN' || $bc == 'JP' ) $currency_before = '¥';
    if( $bc == 'CR' ) $currency_before = '¢';
    if( $bc == 'HR' ) $currency_after = ' kn';
    if( $bc == 'CZ' ) $currency_after = ' kc';
    if( $bc == 'DK' ) $currency_before = 'DKK ';
    if( $bc == 'EE' ) $currency_after = ' EEK';
    if( $bc == 'HK' ) $currency_before = 'HK$';
    if( $bc == 'HU' ) $currency_after = ' Ft';
    if( $bc == 'IS' || $bc == 'SE' ) $currency_after = ' kr';
    if( $bc == 'IN' ) $currency_before = 'Rs. ';
    if( $bc == 'ID' ) $currency_before = 'Rp. ';
    if( $bc == 'IL' ) $currency_after = ' NIS';
    if( $bc == 'LV' ) $currency_before = 'Ls ';
    if( $bc == 'LT' ) $currency_after = ' Lt';
    if( $bc == 'MY' ) $currency_before = 'RM';
    if( $bc == 'MT' ) $currency_before = 'Lm';
    if( $bc == 'NO' ) $currency_before = 'kr ';
    if( $bc == 'PH' ) $currency_before = 'PHP';
    if( $bc == 'PL' ) $currency_after = ' z';
    if( $bc == 'RO' ) $currency_after = ' lei';
    if( $bc == 'RU' ) $currency_before = 'RUB';
    if( $bc == 'SK' ) $currency_after = ' Sk';
    if( $bc == 'ZA' ) $currency_before = 'R ';
    if( $bc == 'KR' ) $currency_before = 'W';
    if( $bc == 'CH' ) $currency_before = 'SFr. ';
    if( $bc == 'SY' ) $currency_after = ' SYP';
    if( $bc == 'TH' ) $currency_after = ' Bt';
    if( $bc == 'TT' ) $currency_before = 'TT$';
    if( $bc == 'TR' ) $currency_after = ' TL';
    if( $bc == 'AE' ) $currency_before = 'Dhs. ';
    if( $bc == 'VE' ) $currency_before = 'Bs. ';
    
    if( $currency_before == '' && $currency_after == '' ) $currency_before = '$';
    
    return $currency_before . number_format( $amount, 2 ) . $currency_after;
}

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

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

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

PHP PHP国家代码到国家/地区名称列表

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

PHP PHP国家/地区代码到大陆与切换错误html删除

php Woocommerce重新订购国家/地区列表(例如,将英国和美国排在最前面)