Convert float to string in php?

前端 未结 6 1839
予麋鹿
予麋鹿 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:30

    I solved this issue by passing the argument JSON_BIGINT_AS_STRING for the options parameter.

    json_decode($json, false, 512, JSON_BIGINT_AS_STRING)

    See example #5 in the json_decode documentation

提交回复
热议问题