Home > Article > Backend Development > How to disable scientific notation in php
In PHP, you can use the formatting number function "number_format()" to prevent numbers from being displayed in scientific notation. Use methods such as "echo number_format("5000000",2,",",".") ;".
The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
How to disable scientific notation in php? PHP prevents numbers from being displayed as scientific notation
When encountering scientific notation
The solution is
Use PHP formatting number function: number_format()
The usage method is as follows:
echo number_format("5000000")."<br>"; //5,000,000 echo number_format("5000000",2)."<br>"; //5,000,000.00 echo number_format("5000000",2,",","."); //5.000.000,00
There is also an online chestnut:
//举个例子 echo '1869879738796128'; //默认结果为:1.8698797387961E+15 //解决办法 echo number_format(‘1869879738796128’, 0, '', ''); //输出结果为:1869879738796128
Recommended learning: "PHP Video Tutorial 》
The above is the detailed content of How to disable scientific notation in php. For more information, please follow other related articles on the PHP Chinese website!