PHP 5.6.25
//float type
$money = 223.1;
//echo
d:233.1 //serialize
233.1 //json_encode
233.1 //未处理
PHP 7.0.*
d:233.09999999999999; //serialize
233.1 //json_encode
233.1 //未处理
修改PHP默认配置项: php.ini默认配置项
; When floats & doubles are serialized store serialize_precision significant
; digits after the floating point. The default value ensures that when floats
; are decoded with unserialize, the data will remain the same.
serialize_precision = 17
改为小于 17
结果
d:233.1; //serialize
233.1 //json_encode
233.1 //未处理