Erwin Erwin - 4 years ago 186
PHP Question

PHP: get number of decimal digits

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)



Answer Source
$str = "1.23444";
print strlen(substr(strrchr($str, "."), 1));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download