php sprintf
程序员文章站
2023-12-21 14:47:58
...
<?php $num = 1234.5678; $str = "decimals"; echo sprintf("%.2f", $num).'<br />'; echo sprintf("%2$.2f", $str, $num); //1234.57<br />1234.57