我有这个 php
<?php echo round($price, 2); ?>
和也许$price1.0000
$price
1.0000
我想要,但我只得到1.001
1.00
1
任何想法
number_format作品:
echo number_format($price, 2);
以下调用应该适合您:printf()
printf()
<?php printf("%.2f", $price); ?>
此语法的文档最好在 sprintf() 页面上进行描述。
sprintf()