PHP7.1 json_encode() Float Issue

后端 未结 11 1017
既然无缘
既然无缘 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:33

    You could change the [max] => 472.185 from a float into a string ([max] => '472.185') before the json_encode(). As json is a string anyway, converting your float values to strings before json_encode() will maintain the value you desire.

提交回复
热议问题