Home > Backend Development > PHP Tutorial > 溢出 - 如何得到PHP 浮点型的真实值? 1.5265646464633E+21

溢出 - 如何得到PHP 浮点型的真实值? 1.5265646464633E+21

WBOY
Release: 2016-06-06 20:41:23
Original
1037 people have browsed it

PHP每次导出为csv,数字结尾就会变成E+一个数字。

<code><br>$s = 1526564646463333565222;
echo $s;
//1.5265646464633E+21
</code>
Copy after login
Copy after login

PHP如何才可以将浮点型的字符串反转换为 原始值?

<code>function getTrueValue($str){
    //@todo
}
$str = '1.5265646464633E+21';
</code>
Copy after login
Copy after login

回复内容:

PHP每次导出为csv,数字结尾就会变成E+一个数字。

<code><br>$s = 1526564646463333565222;
echo $s;
//1.5265646464633E+21
</code>
Copy after login
Copy after login

PHP如何才可以将浮点型的字符串反转换为 原始值?

<code>function getTrueValue($str){
    //@todo
}
$str = '1.5265646464633E+21';
</code>
Copy after login
Copy after login

sprintf或者number_format

<code>$s = 1526564646463333565222;
printf("%.0f", $s);
echo "\r\n";
echo number_format($s,0,'','');
</code>
Copy after login
Related labels:
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template