number_format_i18n( float $number, int $decimals )
Convert float number to format based on the locale.
Parameters
- $number
-
(Required) The number to convert based on locale.
- $decimals
-
(Optional) Precision of the number of decimal places. Default 0.
Return
(string) Converted number in string format.
Source
File: wp-includes/functions.php
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 WP-2.8.0
* @since WP-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 );
}
Related
Uses
Uses | Description |
---|---|
wp-includes/plugin.php: apply_filters() |
Call the functions added to a filter hook. |
wp-includes/functions.php: absint() |
Convert a value to non-negative integer. |
wp-includes/functions.php: number_format_i18n |
Filters the number formatted based on the locale. |
Used By
Used By | Description |
---|---|
wp-includes/general-template.php: paginate_links() |
Retrieve paginated link for archive post pages. |
wp-includes/widgets/class-wp-widget-media.php: WP_Widget_Media::display_media_state() |
Filters the default media display states for items in the Media list table. |
wp-includes/class-wp-customize-widgets.php: WP_Customize_Widgets::enqueue_scripts() |
Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
wp-includes/pluggable.php: wp_notify_moderator() |
Notifies the moderator of the site about a new comment that is awaiting approval. |
wp-includes/admin-bar.php: wp_admin_bar_comments_menu() |
Add edit comments link with awaiting moderation count bubble. |
wp-includes/admin-bar.php: wp_admin_bar_updates_menu() |
Provide an update link if theme/plugin/core updates are available. |
wp-includes/embed.php: print_embed_comments_button() |
Prints the necessary markup for the embed comments button. |
wp-includes/category-template.php: wp_generate_tag_cloud() |
Generates a tag cloud (heatmap) from provided data. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::handle_load_themes_request() |
Load themes into the theme browsing/installation UI. |
wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::save_changeset_post() |
Save the post for the loaded changeset. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::customize_register() |
Add the customizer settings and controls. |
wp-includes/class-walker-category-dropdown.php: Walker_CategoryDropdown::start_el() |
Starts the element output. |
wp-includes/class-wp-customize-nav-menus.php: WP_Customize_Nav_Menus::enqueue_scripts() |
Enqueue scripts and styles for Customizer pane. |
wp-includes/ms-functions.php: wpmu_validate_blog_signup() |
Processes new site registrations. |
wp-includes/load.php: timer_stop() |
Retrieve or display the time from the page start to when function is called. |
wp-includes/class-walker-category.php: Walker_Category::start_el() |
Starts the element output. |
wp-includes/comment-template.php: comments_popup_link() |
Displays the link to the comments for the current post ID. |
wp-includes/comment-template.php: get_comments_number_text() |
Display the language string for the number of comments the current post has. |
wp-includes/functions.php: size_format() |
Convert number of bytes largest unit bytes will fit into. |
wp-admin/includes/deprecated.php: WP_User_Search::do_paging() |
Handles paging for the user search query. |
wp-admin/includes/class-wp-screen.php: WP_Screen::render_screen_layout() |
Render the option for number of columns on the page |
wp-admin/includes/class-wp-plugins-list-table.php: WP_Plugins_List_Table::get_views() | |
wp-admin/includes/class-wp-list-table.php: WP_List_Table::comments_bubble() |
Display a comment count bubble |
wp-admin/includes/class-wp-list-table.php: WP_List_Table::pagination() |
Display the pagination. |
wp-admin/includes/class-wp-list-table.php: WP_List_Table::ajax_response() |
Handle an incoming ajax request (called from admin-ajax.php) |
wp-admin/includes/media.php: media_upload_library_form() |
Outputs the legacy media upload form for the media library. |
wp-admin/includes/class-wp-ms-themes-list-table.php: WP_MS_Themes_List_Table::get_views() | |
wp-admin/includes/media.php: media_handle_upload() |
Save a file submitted from a POST request and create an attachment post for it. |
wp-admin/includes/template.php: wp_star_rating() |
Output a HTML element with a star rating for a given rating. |
wp-admin/includes/class-wp-comments-list-table.php: WP_Comments_List_Table::get_views() | |
wp-admin/includes/class-wp-posts-list-table.php: WP_Posts_List_Table::get_views() | |
wp-admin/includes/class-wp-ms-users-list-table.php: WP_MS_Users_List_Table::get_views() | |
wp-admin/includes/plugin-install.php: install_plugin_information() |
Display plugin information in dialog box form. |
wp-admin/includes/ajax-actions.php: wp_ajax_query_themes() |
Ajax handler for getting themes from themes_api(). |
wp-admin/includes/ajax-actions.php: wp_ajax_replyto_comment() |
Ajax handler for replying to a comment. |
wp-admin/includes/ajax-actions.php: _wp_ajax_delete_comment_response() |
Sends back current comment total and new page links if they need to be updated. |
wp-admin/includes/class-wp-plugin-install-list-table.php: WP_Plugin_Install_List_Table::display_rows() | |
wp-admin/includes/meta-boxes.php: post_submit_meta_box() |
Displays post submit form fields. |
wp-admin/includes/class-wp-ms-sites-list-table.php: WP_MS_Sites_List_Table::column_users() |
Handles the users column output. |
wp-admin/includes/dashboard.php: wp_dashboard_quota() |
Display file upload quota on dashboard. |
wp-admin/includes/dashboard.php: wp_dashboard_right_now() |
Dashboard widget that displays some basic stats about the site. |
wp-admin/includes/dashboard.php: wp_network_dashboard_right_now() | |
wp-admin/includes/class-wp-users-list-table.php: WP_Users_List_Table::single_row() |
Generate HTML for a single row on the users.php admin panel. |
wp-admin/includes/class-wp-terms-list-table.php: WP_Terms_List_Table::column_posts() | |
wp-admin/includes/class-wp-terms-list-table.php: WP_Terms_List_Table::column_links() | |
wp-admin/includes/class-wp-users-list-table.php: WP_Users_List_Table::get_views() |
Return an associative array listing all the views that can be used with this table. |
Changelog
Version | Description |
---|---|
WP-2.3.0 | Introduced. |