求一个正则表达式 去除小数点后面的000
比如
8.38370000
要结果为 8.3837
8.0038370000
要结果为 8.3837
8.38370010
要结果为 8.3837001
[解决办法]
$s =<<< TXT8.3837
8.38370000
8.0038370000
8.38370010
TXT;
echo preg_replace('/(?<=\d)0+\b
[解决办法]
(?<=\.)0+/', '', $s);
$string = "8.38370010";8.3837001
echo (float)$string;