When I output some of my double variables, they are written exponentially using fwrite. Can I set some default values ββin PHP, where whenever a variable is displayed (copied or saved), it always happens in decimal format?
To be precise, the problem occurs when I use the json_decode method on a json string that contains a double value (which is not in exponential form). This double value after the transformation of the object becomes exponential.
, ( ), :
echo rtrim(sprintf("%0.15f", $x), "0.");
, . sprintf 15 , 0 .. (, , , .)
sprintf
0
.
, 15 rtrim.
15
rtrim
, json_decode / .
json_decode
, PHP-float, ...
precision
precision = 20
ini_set('precision', 20);
php_value precision 20
, , BIGINT PHP 5.3+, json_decode : json_decode($json, true, 512, JSON_BIGINT_AS_STRING)
BIGINT
json_decode($json, true, 512, JSON_BIGINT_AS_STRING)
Source: https://habr.com/ru/post/1778535/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1778530/user-has-to-login-again-when-i-redirect-from-http-to-https&usg=ALkJrhiBu3RM7jeg00EBrIcIo337hzDyHgHow to get a list of all tokens from the Solr / Lucene index? - luceneAdvanced use of the msg * command in a batch file? - windows-7Get rid of document.write? - javascriptLooking for combinations that are up to 15 in a hand card - javaIntroductory line left in C troubles - chttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1778537/cxfreeze-how-can-i-install-the-shared-libraries-to-usrlib&usg=ALkJrhjxQ6GeBADfr3H6chdhNp06jYWvngC # - sorting a list inside a structure - sortingMy string filling function in C not working? - cApplication for OS X Ruby - ruby ββ| fooobar.comAll Articles