在sql表中双浮点数,如
145.00000000,2.0000000000,23.12000000,12.02400000,0.026,0.5402,
如何使用php
来完成这些没有小数0的数字145,2,23.12,12.024,0.026,0.5402,
答案 0 :(得分:0)
只需在PHP中转换为float
,它将删除尾随的零:
$float = '145.00000000';
echo (float)$float; // 145
$float = '23.12000000';
echo (float)$float; // 23.12