PHP四舍五入 保留几位小数 格式化数字

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

<?php
 
/** 1.number_format */
$number = 1234.56789;
$nombre_format_francais = number_format($number, 2, ',', ' ');
$english_format_number = number_format($number, 2, '.', '');  
 
 
/** 2.round */
$number = 1234.56789;
echo round($number ,2);
 
 
/** 3.sprintf */
$formatted = sprintf ("¥%01.2f。", $money);
echo $formatted;
 
?>