Home > Backend Development > PHP Tutorial > 如何去掉后面的0

如何去掉后面的0

WBOY
Release: 2016-06-13 10:35:57
Original
1966 people have browsed it

怎么去掉后面的0
10000000000 变成 10
10020000000 变成 1020
10020030000 变成 102030


这个怎么实现呢?

------解决方案--------------------
echo preg_replace('/0+$/','0',10020030000);
------解决方案--------------------
上次你要加上,这次要去掉...
------解决方案--------------------
表中没有pid 字段吗? 父类 pid=0 这样查询不就容易多了。
------解决方案--------------------
正则取出非零数,拼装成2位...

探讨
10000000000 变成 10
10020000000 变成 1020
10020030000 变成 102030


这个怎么实现呢?

------解决方案--------------------
探讨
刚才加了一个pid 终于弄好了引用:

------解决方案--------------------
"上面说我用了like响查询" ?
------解决方案--------------------
探讨

刚才加了一个pid 终于弄好了引用:

正则取出非零数,拼装成2位...

引用:
10000000000 变成 10
10020000000 变成 1020
10020030000 变成 102030


这个怎么实现呢?

------解决方案--------------------
echo preg_replace('/0+/','0',10020000000);
Related labels:
pid
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