Number of digits before the decimal point in the division of two numbers | Function to return the number of digits before the decimal in a / b ; Return the required count of digits ; Driver code
< ? php function countDigits ( $ a , $ b ) { return floor ( log10 ( abs ( $ a ) ) - log10 ( abs ( $ b ) ) ) + 1 ; } $ a = 100 ; $ b = 10 ; echo countDigits ( $ a , $ b ) ; ? >