Home > php教程 > php手册 > body text

PHP大整数输出成科学计数法问题

WBOY
Release: 2016-06-07 11:34:32
Original
1383 people have browsed it

最近做项目,发现大整数会变成科学技术输出。网上找到的简单方法。
<?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元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template