tkrehbiel tkrehbiel - 1 year ago 74
PHP Question

What's the best way to get the fractional part of a float in PHP?

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.

Answer Source
$x = $x - floor($x)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download