Home  >  Article  >  php教程  >  PHP大整数输出成科学计数法问题

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

WBOY
WBOYOriginal
2016-06-07 11:34:321381browse

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

Statement:
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