Program to count digits in an integer ( 4 Different Methods ) | Recursive PHP program to count number of digits in a number ; Driver Code
< ? php function countDigit ( $ n ) { if ( $ n / 10 == 0 ) return 1 ; return 1 + countDigit ( ( int ) ( $ n / 10 ) ) ; } $ n = 345289467 ; print ( " Number ▁ of ▁ digits ▁ : ▁ " . ( countDigit ( $ n ) ) ) ; ? >