PHP7.1 json_encode() Float Issue

后端 未结 11 1009
既然无缘
既然无缘 2020-11-27 13:00

This isn\'t a question as it is more of a be aware. I updated an application that uses json_encode() to PHP7.1.1 and I was seeing an issue with floats being cha

11条回答
  •  一生所求
    2020-11-27 13:23

    I solved this by setting both precision and serialize_precision to the same value (10):

    ini_set('precision', 10);
    ini_set('serialize_precision', 10);
    

    You can also set this in your php.ini

提交回复
热议问题