1

Using php7.1, this:

json_encode(['value' => 0.00001]);

would return this string:

{"value":1.0e-5}

although I would like to get {"value":0.0001}

How can I achieve that?

Here is what I've tried so far:

json_encode(['value' => '0.00001']);
// returns {"value":"0.0001"}, not {"value":0.0001}

json_encode(['value' => '0.00001'], JSON_NUMERIC_CHECK);
// returns {"value":1.0e-5}
4

0 回答 0