在PHP中获取小数部分的最佳方法是什么?
问题描述:
简单的一个:如何在PHP中找到浮点数的小数部分?例如,如果我的值为1.25,我想返回0.25.
Simple one: How would you find the fractional part of a floating point number in PHP? For example, if I have the value 1.25, I want to return 0.25.
答
$x = $x - floor($x)