|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-12-04 12:31 UTC] cmb@php.net
-Type: Bug
+Type: Feature/Change Request
-Package: *General Issues
+Package: JSON related
[2020-12-04 12:31 UTC] cmb@php.net
[2020-12-04 14:10 UTC] antonino dot spampinato86 at gmail dot com
[2020-12-04 20:32 UTC] antonino dot spampinato86 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 14:00:01 2025 UTC |
Description: ------------ json_encode() with JSON_NUMERIC_CHECK needs a way to encode strings as numbers WITHOUT converting them to float first. You just can't use money types and pass them with the built in json_encode() feature. I've looked all over and there is no solution except to create my own json_encode() which will bear performance issues compared to the built-in method. Test script: --------------- echo json_encode(['x'=>'0.00000001'], JSON_NUMERIC_CHECK)."\n"; Expected result: ---------------- {"x":0.00000001} Actual result: -------------- {"x":1.0e-8}