Convert float to string in php?

前端 未结 6 1822
予麋鹿
予麋鹿 2021-02-18 13:01

Like:

float(1.2345678901235E+19) => string(20) \"12345678901234567890\"

Can it be done?

(it\'s for json_decode...)

6条回答
  •  隐瞒了意图╮
    2021-02-18 13:48

    The only way to decode a float without losing precision is to go through the json and frame all the floats in quotation marks. By making strings of numbers.

    PHP json_decode integers and floats to string

提交回复
热议问题