$price = "20.00"; $price = preg_replace('/\.0+$/', '', $price); echo $price."\n"; //结果: 20 $price = "20.60"; $price = preg_replace('/\.0+$/', '', $price); echo $price."\n"; //结果: 20.60
日期:2014-05-16 浏览次数:20706 次
$price = "20.00"; $price = preg_replace('/\.0+$/', '', $price); echo $price."\n"; //结果: 20 $price = "20.60"; $price = preg_replace('/\.0+$/', '', $price); echo $price."\n"; //结果: 20.60