this is a part of my code.I'd like get int value 2040 but the int value is 2039.
$double = 100 * '20.40';
$int = (int)$double;
echo gettype($double)."=$double\n"; //output 2040
echo gettype($int)."=$int\n"; //output 2039
this is a part of my code.I'd like get int value 2040 but the int value is 2039.
$double = 100 * '20.40';
$int = (int)$double;
echo gettype($double)."=$double\n"; //output 2040
echo gettype($int)."=$int\n"; //output 2039
$double = 100 * 20.40;
$int = (int)round($double);
echo gettype($double)."=$double\n"; //output double=2040
echo gettype($int)."=$int\n"; //output integer=2040