As shown in the code sample below the conversion of a float value of 43648
to integer with intval()
yields int(43647)
and not int(43648)
.
Code:
$f = (float)"43.650" - 0.002;
var_dump($f);
var_dump($f*1000);
var_dump(intval($f*1000));
Output:
float(43.648)
float(43648)
int(43647)
Why?