bp_core_number_format( int $number, bool $decimals = false )

Format numbers the BuddyPress way.


Parameters Parameters

$number

(int) (Required) The number to be formatted.

$decimals

(bool) (Optional) Whether to use decimals. See number_format_i18n().

Default value: false


Top ↑

Return Return

(string) The formatted number.


Source Source

File: bp-core/bp-core-functions.php

function bp_core_number_format( $number = 0, $decimals = false ) {

	// Force number to 0 if needed.
	if ( ! is_numeric( $number ) ) {
		$number = 0;
	}

	/**
	 * Filters the BuddyPress formatted number.
	 *
	 * @since 1.2.4
	 *
	 * @param string $value    BuddyPress formatted value.
	 * @param int    $number   The number to be formatted.
	 * @param bool   $decimals Whether or not to use decimals.
	 */
	return apply_filters( 'bp_core_number_format', number_format_i18n( $number, $decimals ), $number, $decimals );
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.