number_format_i18n

The timeline below displays how wordpress function number_format_i18n has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Converts float number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @param float $number   The number to convert based on locale.
 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filters the number formatted based on the locale.
     *
     * @since 2.8.0
     * @since 4.9.0 The `$number` and `$decimals` parameters were added.
     *
     * @param string $formatted Converted number in string format.
     * @param float  $number    The number to convert based on locale.
     * @param int    $decimals  Precision of the number of decimal places.
     */
    return apply_filters('number_format_i18n', $formatted, $number, $decimals);
}

WordPress Version: 5.3

/**
 * Convert float number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale WordPress date and time locale object.
 *
 * @param float $number   The number to convert based on locale.
 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filters the number formatted based on the locale.
     *
     * @since 2.8.0
     * @since 4.9.0 The `$number` and `$decimals` parameters were added.
     *
     * @param string $formatted Converted number in string format.
     * @param float  $number    The number to convert based on locale.
     * @param int    $decimals  Precision of the number of decimal places.
     */
    return apply_filters('number_format_i18n', $formatted, $number, $decimals);
}

WordPress Version: 5.1

/**
 * Convert float number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale
 *
 * @param float $number   The number to convert based on locale.
 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filters the number formatted based on the locale.
     *
     * @since 2.8.0
     * @since 4.9.0 The `$number` and `$decimals` parameters were added.
     *
     * @param string $formatted Converted number in string format.
     * @param float  $number    The number to convert based on locale.
     * @param int    $decimals  Precision of the number of decimal places.
     */
    return apply_filters('number_format_i18n', $formatted, $number, $decimals);
}

WordPress Version: 4.9

/**
 * Convert float number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale
 *
 * @param float $number   The number to convert based on locale.
 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filters the number formatted based on the locale.
     *
     * @since 2.8.0
     * @since 4.9.0 The `$number` and `$decimals` arguments were added.
     *
     * @param string $formatted Converted number in string format.
     * @param float  $number    The number to convert based on locale.
     * @param int    $decimals  Precision of the number of decimal places.
     */
    return apply_filters('number_format_i18n', $formatted, $number, $decimals);
}

WordPress Version: 4.6

/**
 * Convert float number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale
 *
 * @param float $number   The number to convert based on locale.
 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filters the number formatted based on the locale.
     *
     * @since  2.8.0
     *
     * @param string $formatted Converted number in string format.
     */
    return apply_filters('number_format_i18n', $formatted);
}

WordPress Version: 4.5

/**
 * Convert float number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale
 *
 * @param float $number   The number to convert based on locale.
 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filter the number formatted based on the locale.
     *
     * @since  2.8.0
     *
     * @param string $formatted Converted number in string format.
     */
    return apply_filters('number_format_i18n', $formatted);
}

WordPress Version: 4.4

/**
 * Convert integer number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale
 *
 * @param int $number   The number to convert based on locale.
 * @param int $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    if (isset($wp_locale)) {
        $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    } else {
        $formatted = number_format($number, absint($decimals));
    }
    /**
     * Filter the number formatted based on the locale.
     *
     * @since  2.8.0
     *
     * @param string $formatted Converted number in string format.
     */
    return apply_filters('number_format_i18n', $formatted);
}

WordPress Version: 4.3

/**
 * Convert integer number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @global WP_Locale $wp_locale
 *
 * @param int $number   The number to convert based on locale.
 * @param int $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    /**
     * Filter the number formatted based on the locale.
     *
     * @since  2.8.0
     *
     * @param string $formatted Converted number in string format.
     */
    return apply_filters('number_format_i18n', $formatted);
}

WordPress Version: 4.0

/**
 * Convert integer number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @param int $number   The number to convert based on locale.
 * @param int $decimals Optional. Precision of the number of decimal places. Default 0.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    /**
     * Filter the number formatted based on the locale.
     *
     * @since  2.8.0
     *
     * @param string $formatted Converted number in string format.
     */
    return apply_filters('number_format_i18n', $formatted);
}

WordPress Version: 3.9

/**
 * Convert integer number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @param int $number The number to convert based on locale.
 * @param int $decimals Precision of the number of decimal places.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    /**
     * Filter the number formatted based on the locale.
     *
     * @since  2.8.0
     *
     * @param string $formatted Converted number in string format.
     */
    return apply_filters('number_format_i18n', $formatted);
}

WordPress Version: 3.7

/**
 * Convert integer number to format based on the locale.
 *
 * @since 2.3.0
 *
 * @param int $number The number to convert based on locale.
 * @param int $decimals Precision of the number of decimal places.
 * @return string Converted number in string format.
 */
function number_format_i18n($number, $decimals = 0)
{
    global $wp_locale;
    $formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
    return apply_filters('number_format_i18n', $formatted);
}