Home  >  Article  >  Backend Development  >  格式化数字的方法?

格式化数字的方法?

WBOY
WBOYOriginal
2016-06-23 14:26:01749browse

比如0.21951100 ,我只想取得小数点后面的数字,则是21951100,不用explode函数能实现吗?


回复讨论(解决方案)

转成字符串类型 然后通过substring 截取小数点后面数字 

方法很多

随便举一个

$a = "0.21951100";echo substr($a,strpos($a,".")+1);
 

21951100 

另求当

$a = 0.21951100; //此时$a是数字类型//从这里开始还有没有可能知道0.219511后边还有两个0?

最强大家,直接str_replace ,分给我,不谢。

Statement:
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