Given, say, 1.25 - how do I get \"1\" and .\"25\" parts of this number?
I need to check if the decimal part is .0, .25, .5, or .75.
Brad Christie's method is essentially correct but it can be written more concisely.
function extractFraction ($value)
{
$fraction = $value - floor ($value);
if ($value < 0)
{
$fraction *= -1;
}
return $fraction;
}
This is equivalent to his method but shorter and hopefully easier to understand as a result.