search
Homephp教程php手册php localeconv() 函数实例讲解,localeconv实例讲解

php localeconv() 函数实例讲解,localeconv实例讲解

php localeconv() 函数返回一包含本地数字及货币格式信息的数组。本文章向码农介绍php localeconv() 函数的使用方法和基本实例。需要的码农可以参考一下。

定义和用法

localeconv() 函数返回一包含本地数字及货币格式信息的数组。

localeconv() 函数会返回以下数组元素:

  • [decimal_point] - 小数点字符
  • [thousands_sep] - 千位分隔符
  • [int_curr_symbol] - 货币符号 (例如:USD)
  • [currency_symbol] - 货币符号 (例如:$)
  • [mon_decimal_point] - 货币小数点字符
  • [mon_thousands_sep] - 货币千位分隔符
  • [positive_sign] - 正值字符
  • [negative_sign] - 负值字符
  • [int_frac_digits] - 国际通用小数位
  • [frac_digits] - 本地通用小数位
  • [p_cs_precedes] - 如果货币符号在一个正数值之前显示,则为 True(1),如果在正数值之后显示,则为 False(0)
  • [p_sep_by_space] - 如果在货币符号和正数值之间包含空格,则为 True(1),否则为 False(0)
  • [n_cs_precedes] - 如果货币符号在一个负数值之前显示,则为 True(1),如果在负数值之后显示,则为 False(0)
  • [n_sep_by_space] - 如果在货币符号和负数值之间包含空格,则为 True(1),否则为 False(0)
  • [p_sign_posn] - 格式化选项:
    • 0 - 把数量和货币符号写在圆括号内
    • 1 - 在数量和货币符号之前加上 + 号
    • 2 - 在数量和货币符号之后加上 + 号
    • 3 - 直接在货币符号之前加上 + 号
    • 4 - 直接在货币符号之后加上 + 号
  • [n_sign_posn] - 格式化选项:
    • 0 - 把数量和货币符号写在圆括号内
    • 1 - 在数量和货币符号之前加上 - 号
    • 2 - 在数量和货币符号之后加上 - 号
    • 3 - 直接在货币符号之前加上 - 号
    • 4 - 直接在货币符号之后加上 - 号
  • [grouping] - 显示数字组合形式的数组(例如:3 指示 1 000 000)
  • [mon_grouping] - 显示货币数字组合形式的数组(例如:2 指示 1 00 00 00)

提示:如需定义本地设置,请参阅 setlocale() 函数。

提示:如需参阅所有可用的语言代码,请访问我们的语言代码参考手册。

 

语法

localeconv()

 

技术细节

返回值: 返回基于由 setlocale() 设置的当前本地的数据。
PHP 版本: 4.0.5+

 

实例

查找美国本地的数字格式化信息:

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

在线运行

原文地址:http://www.manongjc.com/article/817.html

相关阅读:

php setlocale() 函数设置地区信息(地域信息)

html网页lang 语言设置及参考

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.