WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/number format i18n

Contents

Description

Convert an integer number to format based on the locale.

Usage

<?php number_format_i18n$number$decimals ); ?>

Parameters

$number
(integer) (required) The number to convert based on locale.
Default: None
$decimals
(integer) (optional) Precision of the number of decimal places.
Default: 0

Return Values

(string) 
Converted number in string format.

Examples

Default Usage

$number = 3948;

$formatted = number_format_i18n( $number );

$formatted will now be something like "3,948".

Using the $decimal Parameter

$number = 3948;

$formatted = number_format_i18n( $number, 2 );

$formatted will now be something like "3,948.00".

Notes

Change Log

Source File

number_format_i18n() is located in wp-includes/functions.php

Related

L10n: translate(), __(), _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural()

See also index of Function Reference and index of Template Tags.