|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-01-21 12:45 UTC] chinaearl at gmail dot com
Description: ------------ json_encode json_preserve_zero_fraction parameter only display one zero json_encode([5.00], JSON_PRESERVE_ZERO_FRACTION); display: 5.0 ============================================================= Hope display: 5.00 Test script: --------------- json_encode json_preserve_zero_fraction parameter only display one zero json_encode([5.00], JSON_PRESERVE_ZERO_FRACTION); display: 5.0 ============================================================= Hope display: 5.00 Expected result: ---------------- json_encode json_preserve_zero_fraction parameter only display one zero json_encode([5.00], JSON_PRESERVE_ZERO_FRACTION); display: 5.0 ============================================================= Hope display: 5.00 Actual result: -------------- json_encode json_preserve_zero_fraction parameter only display one zero json_encode([5.00], JSON_PRESERVE_ZERO_FRACTION); display: 5.0 ============================================================= Hope display: 5.00 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 08:00:01 2025 UTC |
$arr = [ 'a' => (float)1.00 ]; echo json_encode($arr,JSON_PRESERVE_ZERO_FRACTION); output:{"a":1.0} I want output: {"a":1.00}