时间:2021-07-01 10:21:17 帮助过:78人阅读
$b = '8.3';echo number_format(floor($b),1).' 元';
$b = '8.3';echo number_format(floor($b),1).' 元';
$a = '8元';echo preg_replace_callback('#(\d+)元#',create_function('$m','return number_format(floor($m[1]),1)." 元";'),$a);
$a = '8元';$b = '8.3';echo intval($a) . '.0';echo intval($b) . '.0';
$c = sprintf('%.1f',intval($a));
$a =8.3;
//第一种
$c1 = number_format(floor($a),1);
echo $c1 ."
";
//第二种
$c2 =sprintf( "%.1f ",floor($a));
echo $c2 ."
";
$c3 =printf( "%.1f ",floor($a));
echo $c3 ."
";