427
1、使用“小数+0”。
<?php echo'100.00'+0." "; echo'100.01000'+0." "; echo'100.10000'+0." "; ?>
2、用“floatval(小数)”。
<?php echofloatval('100.00')." "; echofloatval('100.01000')." "; echofloatval('100.10000')." "; ?>
3、用“rtrim(rtrim(小数,'0'),'.')”。
<?php echortrim(rtrim('100.00','0'),'.')." "; echortrim(rtrim('100.01000','0'),'.')." "; echortrim(rtrim('100.10000','0'),'.')." "; ?>
4、用“preg_replace('/[.]$/','',preg_replace('/0+$/','',小数)”。
正则表达式说明: /0+$/去掉末尾多余的0 /[.]$/去掉末尾的. echopreg_replace('/[.]$/','',preg_replace('/0+$/','','100.00'))." "; echopreg_replace('/[.]$/','',preg_replace('/0+$/','','100.1000'))." "; echopreg_replace('/[.]$/','',preg_replace('/0+$/','','100.010203000'))." "; ?>