保留价格.00

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-23 13:56:561165browse

 $price = "98.00";$num   = 2;$total = $price * $num;

如何$total保留.00?


回复讨论(解决方案)

number_format 这个函数可以实现

echo sprintf("%.2f",98);

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