PHP大整数输出成科学计数法问题
Jun 07, 2016 am 11:34 AM最近做项目,发现大整数会变成科学技术输出。网上找到的简单方法。<?php <br />
<br>
$str =2228282829299292;<br>
//失败<br>
echo (string)$str; //2.2282828292993E+15 失败<br>
echo '<br>';<br>
echo ' '.$str; //2.2282828292993E+15<br>
echo '<br>';<br>
echo strval($str); //2.2282828292993E+15<br>
echo '<br>';<br>
//成功<br>
echo sprintf("%.0f", $str);<br>
echo '<br>';<br>
echo number_format($str);// 三位逗号分隔<br>
?>
AD:真正免费,域名+虚机+企业邮箱=0元

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Learn about introductory code examples for Python programming

How to use PHP to write inventory management function code in the inventory management system

PHP variables in action: 10 real-life examples of use

Java implements simple bubble sort code

Go language programming examples: code examples in web development

Huawei Cloud Edge Computing Interconnection Guide: Java code examples to quickly implement interfaces

From beginner to proficient: Code implementation of commonly used data structures in Go language

Guidance and Examples: Learn to implement the selection sort algorithm in Java
