Let\'s say we have 0.00045. I want to find a way to count the number of \"significant\" zeros after the decimal point (3 in this case). I\'ve been trying to implement st
strspn($num, "0", strpos($num, ".")+1)
strspn finds the length of a sequence of zeroes. strpos finds the position of the decimal point, and we start from 1 position past that.
However, this doesn't work for 0.0000062 because it gets converted to scientific notation when converted to a string: 6.200000e-6. When the number ends with e-, the number of zeroes is . You can check for this with a regular expression.