How to remove float point, if value is exponent
Solution 1:
You should cast it as string before calling the function, if you're going to apply str_replace
to it.
You could use:
function float_to_integer($v)
{
return((int)str_replace('.', '', $v));
}
$v = 0.00001;
$v = sprintf("%.5f", $v); // returns string(7) "0.00001"
$result = float_to_integer($v); // returns int(1)
But then you need to know how many decimal digits there are after the floating point to put instead of "%.5f"
.