$num = 10.4567; //第一種:利用round()對浮點數進行四捨五入 echo round($num,2); //10.46 //第二種:利用sprintf格式化字符串 $format_num = sprintf("%.2f",$num); echo $format_num; //10.46 //第三種:利用千位分組來格式化數字的函數number_format() echo number_format($num, 2); //10.46 //或者以下 echo number_format($num, 2, '.', ''); //10/46