Home > Backend Development > PHP Tutorial > 带千分位和小数位的数据写入数据库的有关问题

带千分位和小数位的数据写入数据库的有关问题

WBOY
Release: 2016-06-13 12:24:56
Original
940 people have browsed it

带千分位和小数位的数据写入数据库的问题
310
1,000.00
2,000


上面三个数据,写入数据库是310,1,2,有什么正确的方法写入数据库呢~
------解决思路----------------------

$num = 千分位的数字;<br />$num .= ''; //转为字符串<br />$newnum = str_replace(',', '', $num);<br />$newnum += 0; //转为数字<br />
Copy after login

------解决思路----------------------
str_replace()替换就可

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template