Get the App
SLTechnology News&Howtos  ›  Development  › 

Is there any way to remove commas from php numbers?

Shulou Source: shulou.com Published: 2022-06-03 17:30:54 10月04日 Update

This article will explain in detail how to remove commas from php numbers, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

1. Remove the comma from the number through the str_replace function. Replace some characters in the string with other characters (case sensitive).

Echo str_replace ("," 10000000000.00 ")

Output:

10000000000.00

2. Remove the comma from the number through the number_format function. Format numbers by grouping in thousands of bits.

Note: this function supports one, two, or four parameters (not three).

Echo number_format (1235.369, 2, 6, 7, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4

Output:

1235.37 about php numbers to remove commas what way to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Number comma function character method content article more knowledge article output yes three two parameter size string format comment quality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL OPPO Reno NVidia MariaDB macOS