Number of digits in the product of two numbers | function to count number of digits in the product of two numbers ; if either of the number is 0 , then product will be 0 ; required count of digits ; Driver Code
< ? php function countDigits ( $ a , $ b ) { if ( $ a == 0 or $ b == 0 ) return 1 ; return floor ( log10 ( abs ( $ a ) ) + log10 ( abs ( $ b ) ) ) + 1 ; } $ a = 33 ; $ b = -24 ; echo countDigits ( $ a , $ b ) ; ? >