当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > localeconv() 函数

PHP
PHP 安全邮件
MySQL 介绍
连接 MySQL
创建 MySQL
MySQL 插入记录
MySQL 选择记录
MySQL Where
MySQL Order By
MySQL 记录更新
MySQL 删除记录
PHP ODBC
XML Expat Parser
XML SimpleXML
PHP 数组参考
PHP Calendar
PHP Date
PHP Directory
PHP Filesystem
PHP FTP
PHP HTTP

PHP 中的 localeconv() 函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 576 ::
收藏到网摘: n/a

Definition and Usage
定义和用法

The localeconv() function returns an array containing local numeric and monetary formatting information.
localeconv()函数的作用是:返回当地的数字和货币格式信息。

The localeconv() function will return the following array elements:
localeconv()函数将返回下列数组元素:

  • [decimal_point] - Decimal point character
    [decimal_point] – 十进制小数点字符
  • [thousands_sep] - Thousands separator
    [thousands_sep] – 千位分隔符
  • [int_curr_symbol] - Currency symbol (example: USD)
    [int_curr_symbol] – 货币符号(如:USD)
  • [currency_symbol] - Currency symbol (example: $)
    [currency_symbol] – 货币符号(如:$)
  • [mon_decimal_point] - Monetary decimal point character
    [mon_decimal_point] – 十进制小数点货币字符
  • [mon_thousands_sep] - Monetary thousands separator
    [mon_thousands_sep] – 货币千位分隔符
  • [positive_sign] - Positive value character
    [positive_sign] –正值字符
  • [negative_sign] - Negative value character
    [negative_sign] – 负值字符
  • [int_frac_digits] - International fractional digits
    [int_frac_digits] – 国际通用格式的分数 / 小数
  • [frac_digits] - Local fractional digits
    [frac_digits] – 本地通用格式的分数 / 小数
  • [p_cs_precedes] - True (1) if currency symbol is placed in front of a positive value, False (0) if it is placed behind
    [p_cs_precedes] – 如果货币符号位于正值之前,则为True(1);如在正值之后,则为False(0)
  • [p_sep_by_space] - True (1) if there is a spaces between the currency symbol and a positive value, False (0) otherwise
    [p_sep_by_space] –如果在货币符号和正值之内含有空格,则为True;否则则为False
  • [n_cs_precedes] - True (1) if currency symbol is placed in front of a negative value, False (0) if it is placed behind
    [n_cs_precedes] –如果货币符号位于负值之前,则为True(1);如在负值之后,则为False(0)
  • [n_sep_by_space] - True (1) if there is a spaces between the currency symbol and a negative value, False (0) otherwise
    [n_sep_by_space] -如果在货币符号和负值之内含有空格,则为True;否则则为False
  • [p_sign_posn] - Formatting options:
    [p_sign_posn] –格式选项:
    • 0 - Parentheses surround the quantity and currency symbol
      0 – 将数量和货币符号写在圆括号内
    • 1 - The + sign is placed in front of the quantity and currency symbol
      1 – 在数量和货币符号之前加上“+”符号
    • 2 - The + sign is placed after the quantity and currency symbol
      2 – 在数量和货币符号之后加上“+”符号
    • 3 - The + sign is placed immediately in front of the currency symbol
      3 – 直接在货币符号之前加上“+”符号
    • 4 - The + sign is placed immediately after the currency symbol
      4 – 直接在货币符号之后加上“+”符号
  • [n_sign_posn] - Formatting options:
    [n_sign_posn] –格式选项:
    • 0 - Parentheses surround the quantity and currency symbol
      0 – 将数量和货币符号写在圆括号内
    • 1 - The - sign is placed in front of the quantity and currency symbol
      1 – 在数量和货币符号之前加上符号
    • 2 - The - sign is placed after the quantity and currency symbol
      2 – 在数量和货币符号之后加上符号
    • 3 - The - sign is placed immediately in front of the currency symbol
      3 – 直接在货币符号之前加上符号
    • 4 - The - sign is placed immediately after the currency symbol
      4 – 直接在货币符号之后加上符号
  • [grouping] - Array displaying how numbers are grouped (example: 3 indicates 1 000 000)
    grouping] – 显示数字组合的形式(如:3 显示 1 000 000)
  • [mon_grouping] - Array displaying how monetary numbers are grouped (example: 2 indicates 1 00 00 00)
    [mon_grouping] -显示货币数字组合的形式(如:2显示100 00 00)

Syntax
语法

localeconv()


Tips and Notes
提示

Tip: To define locale settings, see the setlocale() function.
提示:你可以通过setlocale()函数来确定本地属性。


Example
案例

In this example we will find the United States locale numeric formatting information:
在下面的案例中,我们将查找美国当地的用于定义数字格式的信息:

<?php
setlocale(LC_ALL, 'US');
$locale_info = localeconv();
print_r($locale_info);
?>

The output of the code above will be:
上述代码将输出下面的结果:

Array
(
[decimal_point] => .
[thousands_sep] => ,
[int_curr_symbol] => USD
[currency_symbol] => $
[mon_decimal_point] => .
[mon_thousands_sep] => ,
[positive_sign] =>
[negative_sign] => -
[int_frac_digits] => 2
[frac_digits] => 2
[p_cs_precedes] => 1
[p_sep_by_space] => 0
[n_cs_precedes] => 1
[n_sep_by_space] => 0
[p_sign_posn] => 3
[n_sign_posn] => 0
[grouping] => Array ([0] => 3)
[mon_grouping] => Array ([0] => 3)
) 

评论 (0) All

登陆 | 还没注册?