PHP格式化一个没有小数位的数字?

EOB*_*EOB 7 php number-formatting

我有一个这样的数字(字符串):1.00000

如何将这些数字重新格式化为仅为1

谢谢

Joh*_*nde 23

使用 number_format()

echo number_format('1.000000'); // prints 1
Run Code Online (Sandbox Code Playgroud)

或者使用 intval()

echo intval('1.000000'); // prints 1
Run Code Online (Sandbox Code Playgroud)

或者将其转换为整数

echo (int) '1.000000'; // prints 1
Run Code Online (Sandbox Code Playgroud)