PHP Digital Format Function Number_format Introduction

Source: Internet
Author: User
PHP Numeric Format Function Number_format Introduction, Number_format (the number to be formatted, the number of decimal places to keep, the string of decimals, thousands separator).

Number_format function Number_format (the number to be formatted, the number of decimal places to keep, the string of decimals, thousands separator)//Total 4 Parameters The function of the Number_format is to format the number. In the 4 parameters listed above , the first required option, and the others are optional. Parameter description: The number to be formatted (not interpreted) the number of decimal places (optional) that is reserved after formatting the number is prepared to retain several fractional decimal point strings (optional) by default. If you want to use the * number as the decimal point, the parameter value is * For example: 189*00 (189 reserved 2 decimal places, * is the decimal point) thousands separator (optional) By default, if you want to specify a different symbol to be separated by thousands, the parameter value is the semicolon you want to specify, for example: 189^000^000.00 here with the symbol ^ to Acts as a thousands separator. Example:

Number_format (288);--Output 288 number_format (365,2);--Output 365.00 Number_format (365000000,3, ".")  (The number 365000000 is reserved for 3 decimal places, and the decimal point is ".") Representation)--output: 365,000,000.000 Number_format (365000000,2, ".", "*")  (the number 365000000 is reserved for 2 decimal places, and the decimal point is ".") Indicates that the thousand separator is denoted by "*")--Output: 365*000*000.00


The above is the PHP digital Format function Number_format Introduction content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.