PHP:获取十进制数字 [英] PHP: get number of decimal digits
本文介绍了PHP:获取十进制数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在PHP中,是否有一种简单的方法来确定n(n)个整数/双精度值中的小数位数? (即不使用explode
)
Is there a straightforward way of determining the number of decimal places in a(n) integer/double value in PHP? (that is, without using explode
)
推荐答案
$str = "1.23444";
print strlen(substr(strrchr($str, "."), 1));
这篇关于PHP:获取十进制数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文