This function checks validity of kaprekar ' s ▁ constant . ▁ It ▁ returns ▁ kaprekar ' s constant for any four digit number " n " such that all digits of n are not same .
< ? php function kaprekarRec ( $ n , $ prev ) { if ( $ n == 0 ) return 0 ;