text: Function that returns true if n contains digit m exactly k times
code: < ? php function digitWell ( $ n , $ m , $ k ) { $ cnt = 0 ; while ( $ n > 0 ) { if ( $ n % 10 == $ m ) ++ $ cnt ; $ n = floor ( $ n / 10 ) ; } return $ cnt == $ k ; }