bb_number_format_i18n

Convert number to format based on the locale.

Description

(string) bb_number_format_i18n( (number) $number, (null) $decimals = null ); 

Returns (string)

Converted number in string format.

Parameters (2)

0. $number (number)
The number to convert based on locale.
1. $decimals — Optional. (null) => null
Precision of the number of decimal places.

Usage

  1. if ( !function_exists( 'bb_number_format_i18n' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/class.bb-locale.php'; 
  3.  
  4. // The number to convert based on locale. 
  5. $number = null; 
  6.  
  7. // Precision of the number of decimal places. 
  8. $decimals = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_number_format_i18n($number, $decimals); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/class.bb-locale.php  
  1. function bb_number_format_i18n( $number, $decimals = null ) { 
  2. global $bb_locale; 
  3. // let the user override the precision only 
  4. $decimals = ( is_null( $decimals ) ) ? $bb_locale->number_format['decimals'] : intval( $decimals ); 
  5.  
  6. $num = number_format( $number, $decimals, $bb_locale->number_format['decimal_point'], $bb_locale->number_format['thousands_sep'] ); 
  7.  
  8. // let the user translate digits from latin to localized language