Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 sql 表中的双浮点数,如
145.00000000, 2.00000000, 23.12000000, 12.02400000, 0.026, 0.5402,
我怎么能像 php 一样在没有十进制 0 的情况下做这些数字
145、2、23.12、12.024、0.026、0.5402、
Just cast to float in PHP and it will strip the trailing zeros:
float
$float = '145.00000000'; echo (float)$float; // 145 $float = '23.12000000'; echo (float)$float; // 23.12