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
)
Advertisement
Answer
JavaScript
x
$str = "1.23444";
print strlen(substr(strrchr($str, "."), 1));
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));