around:
a.代码:

<?php$num1 = round(5,2);$num2 = round(5.123,2);echo $num1.PHP_EOL;echo $num2.PHP_EOL;

b.输出:

55.12sprintf:
a.代码:

<?php$num1 = sprintf('%.2f',5);$num2 = sprintf('%.2f',5.123);echo $num1.PHP_EOL;echo $num2.PHP_EOL;

b.输出:

5.005.12number_format(推荐):
a.代码:

<?php$num1 = number_format(5,2);$num2 = number_format(5.123,2);echo $num1.PHP_EOL;echo $num2.PHP_EOL;

b.输出:

5.005.12