WordPress Development Tip

In a previous post, I wrote about the usage of the date_i18n function in WordPress called date_i18n Function Reference and Usage.

This post will address how to properly format displaying values (numbers) according to the WordPress blog settings.

The function to use for this is number_format_i18n – Read the reference material on wordpress.org

WordPress comes with a lot of nice features to reduce developer headaches and ensure things just work no matter where you use your code.

The usage is much easier than the date-function, as it is a simple function that accepts only a single parameter, the value to be displayed.


  echo number_format_i18n(4121124);  

The output will display the number 4121124 in the correct localized format for your blog.

1 thought on “number_format_i18n Function Reference and Usage”

  1. Lars, thanks for publishing this post. I hadn’t realised until today there was a function to easily take care of number formatting. The more discussion on it the better!

    One correction, number_format_i18n can optionally take a second parameter – $decimals – representing the number of decimals to include.

Comments are closed.