PHP头条
热点:

php取一位小数


php取一位小数,在线等
$str = 35.5454;

现想取 35.5
怎么实现呀,

------解决方案--------------------
PHP code
$result = round(35.5454,1);

------解决方案--------------------
$str = 35.5454;
$str = number_format($str, 1); 
echo $str;
------解决方案--------------------
探讨

$str = 35.5454;
$str = number_format($str, 1);
echo $str;

------解决方案--------------------
PHP code
$str = 35.5454;
$num =number_format($str,1)

------解决方案--------------------
$xxx=sprintf('%.1f',$xxx);
------解决方案--------------------
$result = round(35.5454,1);
------解决方案--------------------
结帖给分吧。
真的在线么????
------解决方案--------------------
sprintf('%0.1f',$str);
------解决方案--------------------
飘过!
------解决方案--------------------
round(35.5454,1);
------解决方案--------------------
round(3.14159,1);

number_format(3.14159265,1,'.','');//这个效果更佳,尾数是 0 ,会自动补上0的
------解决方案--------------------
探讨
round(3.14159,1);

number_format(3.14159265,1,'.','');//这个效果更佳,尾数是 0 ,会自动补上0的

www.phpzy.comtrue/phprm/54771.htmlTechArticlephp取一位小数 php取一位小数,在线等 $str = 35.5454; 现想取 35.5 怎么实现呀, ------解决方案-------------------- PHP code $result = round(35.5454,1); ------解决方案-------------------- $str = 35.5454; $str = nu...

相关文章

PHP之友评论

今天推荐