PHP 大整数 / 科学计数法 转 字符串

栏目: PHP · 发布时间: 7年前

内容简介:json 数据格式 中 大整数解开 会被转换为科学计数法 使用PHP 科学计数法转字符串

json 数据格式 中 大整数解开 会被转换为科学计数法 使用 JSON_BIGINT_AS_STRING

json_decode 官方文档

json_decode($var, true, '512', JSON_BIGINT_AS_STRING)

PHP 科学计数法转字符串

<?PHP
 function ScToNum($num) {
    $numer = strtoupper($num);
    $parts = explode('E', $numer);
    list($int, $ex_str) = $parts;

    $exp = $ex_str[0];
    $var = substr($ex_str, 1);

    if ($exp == '+') {
        return bcmul($int, bcpow(10, $var));
    }

    return bcdiv($int, bcpow(10, $var));
}

最后更新于 2019-01-07 08:35:26 并被添加「」标签,已有 1 位童鞋阅读过。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

A Common-Sense Guide to Data Structures and Algorithms

A Common-Sense Guide to Data Structures and Algorithms

Jay Wengrow / Pragmatic Bookshelf / 2017-8-13 / USD 45.95

If you last saw algorithms in a university course or at a job interview, you’re missing out on what they can do for your code. Learn different sorting and searching techniques, and when to use each. F......一起来看看 《A Common-Sense Guide to Data Structures and Algorithms》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器