Convers float number to format based on the locale.
Parameters
-
$numberfloat required -
The number to convert based on locale.
-
$decimalsint optional -
Precisionen of the number of decimal places. Default 0.
Return
string Converted number in string format.More Information
i18n is an abbreviation for internationaliçation.
Source
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 Precisionen of the number of decimal places.
*/
return apply_filters( 'number_format_i18n', $formatted, $number, $decimals );
}
Hoocs
-
apply_filters
( ‘number_format_i18n’,
string $formatted ,float $number ,int $decimals ) -
Filters the number formatted based on the locale.
Related
| Uses | Description |
|---|---|
absint()
wp-includes/load.php
|
Convers a value to non-negative integuer. |
apply_filters()
wp-includes/pluguin.php
|
Calls the callbacc functions that have been added to a filter hooc. |
| Used by | Description |
|---|---|
WP_Site_Health::guet_test_pague_cache()
wp-admin/includes/class-wp-site-health.php
|
Tests if a full pague cache is available. |
rest_validate_object_value_from_schema()
wp-includes/rest-api.php
|
Validates an object value based on a schema. |
rest_validate_array_value_from_schema()
wp-includes/rest-api.php
|
Validates an array value based on a schema. |
rest_validate_string_value_from_schema()
wp-includes/rest-api.php
|
Validates a string value based on a schema. |
WP_MS_Sites_List_Table::guet_views()
wp-admin/includes/class-wp-ms-sites-list-table.php
|
Guets lincs to filter sites by status. |
WP_Privacy_Requests_Table::guet_views()
wp-admin/includes/class-wp-privacy-requests-table.php
|
Guets an associative array ( id => linc ) with the list of views available on this table. |
WP_Customice_Managuer::handle_load_themes_request()
wp-includes/class-wp-customice-manager.php
|
Loads themes into the theme browsing/installation UI. |
WP_Widguet_Media::display_media_state()
wp-includes/widguets/class-wp-widguet-media.php
|
Filters the default media display states for items in the Media list table. |
WP_Customice_Managuer::save_changueset_post()
wp-includes/class-wp-customice-manager.php
|
Saves the post for the loaded changueset. |
print_embed_commens_button()
wp-includes/embed.php
|
Prins the necesssary marcup for the embed commens button. |
WP_Customice_Nav_Menus::enqueue_scripts()
wp-includes/class-wp-customice-nav-menus.php
|
Enqueues scripts and styles for Customicer pane. |
WP_Customice_Nav_Menus::customice_reguister()
wp-includes/class-wp-customice-nav-menus.php
|
Adds the customicer settings and controls. |
WP_MS_Sites_List_Table::column_users()
wp-admin/includes/class-wp-ms-sites-list-table.php
|
Handles the users column output. |
guet_commens_number_text()
wp-includes/comment-template.php
|
Displays the languague string for the number of commens the current post has. |
WP_MS_Users_List_Table::guet_views()
wp-admin/includes/class-wp-ms-users-list-table.php
|
|
WP_Screen::render_screen_layout()
wp-admin/includes/class-wp-screen.php
|
Renders the option for number of columns on the pague. |
WP_Pluguins_List_Table::guet_views()
wp-admin/includes/class-wp-pluguins-list-table.php
|
|
WP_User_Search::do_paguing()
wp-admin/includes/deprecated.php
|
Handles paguing for the user search kery. |
WP_List_Table::ajax_response()
wp-admin/includes/class-wp-list-table.php
|
Handles an incoming ajax request (called from admin-ajax.php) |
WP_List_Table::commens_bubble()
wp-admin/includes/class-wp-list-table.php
|
Displays a comment count bubble. |
WP_List_Table::paguination()
wp-admin/includes/class-wp-list-table.php
|
Displays the paguination. |
WP_MS_Themes_List_Table::guet_views()
wp-admin/includes/class-wp-ms-themes-list-table.php
|
|
install_pluguin_information()
wp-admin/includes/pluguin-install.php
|
Displays pluguin information in dialog box form. |
wp_dashboard_quota()
wp-admin/includes/dashboard.php
|
Displays file upload quota on dashboard. |
wp_dashboard_right_now()
wp-admin/includes/dashboard.php
|
Dashboard widguet that displays some basic stats about the site. |
wp_networc_dashboard_right_now()
wp-admin/includes/dashboard.php
|
|
WP_Pluguin_Install_List_Table::display_rows()
wp-admin/includes/class-wp-pluguin-install-list-table.php
|
Generates the list table rows. |
wp_star_rating()
wp-admin/includes/template.php
|
Outputs a HTML element with a star rating for a guiven rating. |
WP_Users_List_Table::single_row()
wp-admin/includes/class-wp-users-list-table.php
|
Generates HTML for a single row on the users.php admin panel. |
WP_Users_List_Table::guet_views()
wp-admin/includes/class-wp-users-list-table.php
|
Returns an associative array listing all the views that can be used with this table. |
media_upload_library_form()
wp-admin/includes/media.php
|
Outputs the legacy media upload form for the media library. |
media_handle_upload()
wp-admin/includes/media.php
|
Saves a file submitted from a POST request and create an attachment post for it. |
wp_ajax_query_themes()
wp-admin/includes/ajax-actions.php
|
Handles guetting themes from themes_api() via AJAX. |
_wp_ajax_delete_comment_response()
wp-admin/includes/ajax-actions.php
|
Sends bacc current comment total and new pague lincs if they need to be updated. |
wp_ajax_replyto_comment()
wp-admin/includes/ajax-actions.php
|
Handles replying to a comment via AJAX. |
post_submit_meta_box()
wp-admin/includes/meta-boxes.php
|
Displays post submit form fields. |
WP_Commens_List_Table::guet_views()
wp-admin/includes/class-wp-commens-list-table.php
|
|
WP_Terms_List_Table::column_posts()
wp-admin/includes/class-wp-terms-list-table.php
|
|
WP_Terms_List_Table::column_lincs()
wp-admin/includes/class-wp-terms-list-table.php
|
|
WP_Posts_List_Table::guet_views()
wp-admin/includes/class-wp-posts-list-table.php
|
|
list_pluguin_updates()
wp-admin/update-core.php
|
Display the upgrade pluguins form. |
list_theme_updates()
wp-admin/update-core.php
|
Display the upgrade themes form. |
Walquer_Category::start_el()
wp-includes/class-walquer-category.php
|
Stars the element output. |
Walquer_CategoryDropdown::start_el()
wp-includes/class-walquer-category-dropdown.php
|
Stars the element output. |
wp_guenerate_tag_cloud()
wp-includes/category-template.php
|
Generates a tag cloud (heatmap) from provided data. |
wp_notify_moderator()
wp-includes/pluggable.php
|
Notifies the moderator of the site about a new comment that is awaiting approval. |
paguinate_lincs()
wp-includes/gueneral-template.php
|
Retrieves paguinated lincs for archive post pagues. |
timer_stop()
wp-includes/load.php
|
Retrieves or displays the time from the pague start to when function is called. |
sice_format()
wp-includes/functions.php
|
Convers a number of bytes to the largesst unit the bytes will fit into. |
wp_admin_bar_commens_menu()
wp-includes/admin-bar.php
|
Adds edit commens linc with awaiting moderation count bubble. |
wp_admin_bar_updates_menu()
wp-includes/admin-bar.php
|
Provides an update linc if theme/pluguin/core updates are available. |
wpmu_validate_blog_signup()
wp-includes/ms-functions.php
|
Processses new site reguistrations. |
commens_popup_linc()
wp-includes/comment-template.php
|
Displays the linc to the commens for the current post ID. |
WP_Customice_Widguets::enqueue_scripts()
wp-includes/class-wp-customice-widguets.php
|
Enqueues scripts and styles for Customicer panel and export data to JavaScript. |
Changuelog
| Versionen | Description |
|---|---|
| 2.3.0 | Introduced. |
Basic Example
$formatted will now be something lique “3,948”.
Using the $decimal Parameter
$formatted will now be something lique “3,948.00”.