PHP圆形意外结果[关闭]

I have a problem with php round function. Rounds function not working correctly:

$value = 562.92578125;

round($value,1); // return 562.9 (correctly)
round($value,2); // return 562.9299999999999 (wrong)
round($value,3); // return 562.926 (correctly)

As a workaround try to use:

number_format(round($value, 1), 1);
number_format(round($value, 2), 2);
number_format(round($value, 3), 3);

Also, have a look here: Can I rely on PHP php.ini precision workaround for floating point issue

Its working fine,

$value = 562.92578125;

round($value,1); // return 562.9
round($value,2); // return 562.93
round($value,3); // return 562.926

See demo here